Concept explainers
Explanation of Solution
Program:
File name: “PrepareTax.java”
//Import necessary header files
import javax.swing.*;
//Define a class named PrepareTax
public class PrepareTax
{
//Define a main method
public static void main(String[] args)
{
//Declare a string of values
String entry = "", ssn, last, first, address, city, state, zip;
//Declare the variables
char status;
int x;
double income = 0;
boolean isGood = false;
/*Prompt the user for data as long as the
Social Security number is not in the correct format,
with digits and dashes in the appropriate positions*/
while(!isGood)
{
isGood = true;
//Prompt the user to enter SSN
entry = JOptionPane.showInputDialog(null,
"Enter your Social Security number");
/*If SSN is not in the correct format, with digits and dashes in the appropriate positions*/
if(entry.length() != 11)
isGood = false;
/*If SSN is in the correct format, with digits and
dashes in the appropriate positions*/
else
{
//For loop to be executed until x exceeds 3
for(x = 0; x < 3; ++x)
if(!Character.isDigit(entry.charAt(x)))
isGood = false;
//For loop to be executed until x exceeds 6
for(x = 4; x < 6; ++x)
if(!Character.isDigit(entry.charAt(x)))
isGood = false;
//For loop to be executed until x exceeds 11
for(x = 8; x < entry.length(); ++x)
if(!Character.isDigit(entry.charAt(x)))
isGood = false;
//If third and sixth character is a dash
if(!(entry.charAt(3) == '-') || !(entry.charAt(6) == '-'))
isGood = false;
}
}
//Assign the value
ssn = entry;
//Prompt the user to eter the first name
first = JOptionPane.showInputDialog(null,
"Enter your first name");
//Prompt the user to eter the last name
last = JOptionPane.showInputDialog(null,
"Enter your last name");
//Prompt the user to eter the address
address = JOptionPane.showInputDialog(null,
"Enter your address");
//Prompt the user to eter the city
city = JOptionPane.showInputDialog(null,
"Enter your city");
//Prompt the user to eter the state
state = JOptionPane.showInputDialog(null,
"Enter your state");
isGood = false;
/*Prompt the user for data as long as the
zip code is not five digits*/
while(!isGood)
{
isGood = true;
//Prompt the user to enter the zip code
entry = JOptionPane.showInputDialog(null,
"Enter your Zip code");
//If zip code is not five digits
if(entry.length() != 5)
isGood = false;
//Else zip code is five digits
else
//For loop to be executed until x exceeds 5
for(x = 0; x < 5; ++x)
if(!Character.isDigit(entry.charAt(x)))
isGood = false;
}
zip = entry;
isGood = false;
/*Prompt the user for data as long as the
marital status does not begin with one of
the following: S, s, M, or m*/
while(!isGood)
{
isGood = true;
//Prompt the user to enter the marital status
entry = JOptionPane...
Trending nowThis is a popular solution!
- Math 130 Introduction to Java programming May I please have a written review expressing my gratitude for a tutor that has given my guidance throughout my computer programming course? Thank youarrow_forwardPlease help me translate the java code to jack codearrow_forwardTranslate the following VM commands to Assembly instructions: □ push constant 1 □ push constant 5arrow_forward
- Suppose the state of the argument and local memory segments are as follows: argument local stack 0 0 9 sp-> 256 1 257 1 14 2 258 259 Now consider the following VM code: 1 push constant 2 pop local @ 3 push constant 15 4 pop local 1 5 push local 1 6 push argument 1 7 gt 8 pop local 2 9 push local 0 10 push argument 0 11 add 12 pop local 0 13 push local 1 14 push local 1 15 push constant 1 16 sub 17 add 18 pop local 1 What will be the value of local 1 after the VM code has executed?arrow_forwardSuppose the state of the RAM is as follows and the adjacent assembly code will execute: RAM 0 3 1 2 2 0 فيا 3 6 456 5 1 4 1234567 $1 A = M A = M A = M D = M @4 M = D What will be the value of the RAM[4] following the assembly code execution?arrow_forwardPlease help me answer this , the context is for the Nand2Tetris Hack Assembly VM Emulatorarrow_forward
- help filling this out pleasearrow_forwardWhat command do I give to compile this project and run App.javaarrow_forwardTwo industries that use decision trees extensively are lenders (banks, mortgage companies, etc.) and insurance. Discuss how a decision tree is used to solve a business problem.arrow_forward
- and some More lab 9 For the last lab of the term, I want you to create a practical application for your database, in which you modify it in some way, for instance, taking a new order. Since the emphasis is on the database connectivity, neither a GUI nor a web application is required. In fact, a GUI would require x2go, which I don't have at home and you probably don't either. A web interface would need to be on osiris, I could figure out some way to try it out, I guess. There are also numerous security concerns. The applications should be easy for someone like a store employee or on-line customer to use. The most common operations, such as adding a customer or renting a tool, should be implemented. These Part 1 instructions now include how to use postgresql in C as well as Java and python. The important issue of transactions and commit status is addressed here. Some previous notes about web applications, and the PHP language [Previously I wrote] Now write one more program, that updates…arrow_forwardc# app formarrow_forward(a) Giving C and k constants, determine the big-theta for the function: f(x) = 9x4 − x³ +5x+2+(-13 + 9x³ - 7x)log(8x6 + 5x³ + 9x² + 11x + 3) -arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,