Hello,
I am continuously receiving errors in the code below. Can you please show me what I am doing wrong?
import java.util.*;
public class ShowTax {
{
public static void main(String [] args)
{
Tax myTax = new Tax();
String ssn, maritalStatus, lname,
fname,zipcode;
double income;
int numberOfVehicles;
Scanner s = new
Scanner(System.in);
String regex =
"[0-9]{3}-[0-9]{2}-[0-9]{4}";
do {
System.out.print("Enter the Social Security Number: ");
ssn =
s.nextLine();
if(!ssn.trim().matches(regex)); {
System.out
.println("SSN must be of 10 length. Please try again!!!");
continue;
}
myTax.setSsn(ssn);
break;
} while (true);
System.out.print("Enter the last
name: ");
lname = s.nextLine();
myTax.setLname(lname);
System.out.print("Enter the first
name: ");
fname = s.nextLine();
myTax.setFname(fname);
system.out.print("Enter the Zip
code: ");
zipcode = s.nextLine();
myTax.setZipCode(zipcode);
do {
try {
System.out.print("Enter the Annual Income:
");
income = s.nextDouble();
if (income < 0) {
System.out
.println("No negative incomes are allowed, so
the value must be above zero. Try Again!!!");
s.nextLine();
continue;
}
} catch
(Exception e) {
System.out
.println("Non-numeric income is allowed. Try Again!!!");
s.nextLine();
continue;
}
myTax.setAnnualIncome(income);
break;
} while (true);
s.nextLine();
do {
System.out.print("Enter the Marital Status: ");
maritalStatus =
s.nextLine();
if
(!("S".equalsIgnoreCase(maritalStatus) || "M"
.equalsIgnoreCase(maritalStatus))) {
System.out
.println("Allowed values are s, S, m, M. Please try
again!!!");
continue;
}
myTax.setMartialStatus(maritalStatus);
break;
} while (true);
System.out.print("Enter the number
of Vehicles Owned: ");
numberOfVehicles =
s.nextInt();
myTax.setNumberOfVehicles(numberOfVehicles);
DisplayTax(myTax);
}
static void DisplayTax(Tax myTax);{
StringBuilder build = new
StringBuilder();
build.append("Social Security
number ").append(myTax.getNumberOfVehicles()).append(",")
.append("last name
").append(myTax.getLname()).append(",")
.append("first name
").append(myTax.getFname()).append(",")
.append("zip code
").append(myTax.getZipCode()).append(",")
.append("annual income
").append(myTax.getAnnualIncome()).append(",")
.append("marital status
").append(myTax.getMartialStatus()).append(",")
.append("number of vehicles owned
").append(myTax.getNumberOfVehicles()).append("\n")
.append("Tax Liability
").append(String.valueOf(myTax.CalculateTax()));
System.out.println(build);
}
}
}
Thank you!
line no30: systax error. in system S should be capital
in line no 6 Tax myTax = new Tax(); you are trying to create object for Tax class. but in this program there is no such class.
please find the Tax class and place the tax class code in the program.
all errors are related to Tax class object only.
Hello, I am continuously receiving errors in the code below. Can you please show me what...
I need to change the following code so that it results in the
sample output below but also imports and utilizes the code from the
GradeCalculator, MaxMin, and Student classes in the com.csc123
package. If you need to change anything in the any of the classes
that's fine but there needs to be all 4 classes. I've included the
sample input and what I've done so far:
package lab03;
import java.util.ArrayList;
import java.util.Scanner;
import com.csc241.*;
public class Lab03 {
public...
Hello Can you help to fix the program. When running, it still show Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class Contact location: class ContactMap at ContactMap.main(ContactMap.java:40) C:\Users\user\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 1 second) ************************ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class ContactMap { public static void main(String args[]) throws IOException { Scanner input=new Scanner(System.in); //Create a TreeMap ,...
Can you tell me what is wrong and fix this code. Thanks #include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; //function void displaymenu1(); int main ( int argc, char** argv ) { string filename; string character; string enter; int menu1=4; char repeat; // = 'Y' / 'N'; string fname; string fName; string lname; string Lname; string number; string Number; string ch; string Displayall; string line; string search; string found; string document[1000][6]; ifstream infile; char s[1000];...
Can you help me rearrange my code to make it look cleaner but still give the same output? Also kindly add an in-line comment on what changes and rearrangement you've done so I can understand what's going on. import java.util.ArrayList; import java.util.Scanner; public class Bank { /** * Add and read bank information to the user. * @param arg A string, double and int array containing * the command line arguments. * @exception Any exception * @return an arraylsit of...
Can you help me rearrange my code by incorporating switch I'm not really sure how to do it and it makes the code look cleaner. Can you help me do it but still give the same output? Also kindly add an in-line comment on what changes and rearrangement you've done so I can understand what's going on. import java.util.ArrayList; import java.util.Scanner; public class Bank { /** * Add and read bank information to the user. * @param arg A string,...
I am almost done with this code, but for some reason I am still getting an error message: Some of the instructions were: Using a loop, prompt for a currency to find. Inside the loop that manages the input, call the lookUpCurrency() method can pass the inputted currency code value. The lookUpCurrency() method needs to loop through the list of currencies and compare the passed currency code with the code in the array. If found, return true - otherwise return...
Hi. Could you help me with the code below? I need to validate the code below, using expressions that can carry out the actions or that make appropriate changes to the program’s state, using conditional and iterative control structures that repeat actions as needed. The unit measurement is missing from the final output and I need it to offer options to lbs, oz, grams, tbsp, tsp, qt, pt, and gal. & fl. oz. Can this be added? The final output...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...