Question

Hello, I am continuously receiving errors in the code below. Can you please show me what...

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!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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.

Add a comment
Know the answer?
Add Answer to:
Hello, I am continuously receiving errors in the code below. Can you please show me what...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need to change the following code so that it results in the sample output below...

    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...

  • Can you tell me what is wrong and fix this code. Thanks #include <iostream> #include <string>...

    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 by incorporating switch I'm not really sure how to...

    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,...

  • 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 conditiona...

    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...

    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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT