Question: Please see the class below and explain why each line of code is correct or incorrect. Write your answers as comments. Fix the errors
Please see the class below and explain why each line of code is correct or incorrect. Write your answers as comments. Fix the errors in the code and add this class file to your folder. public class Problem1 { public static void main(String[] args) { int j, i = 1; float f1 } } 0.1; float f2 = 123; long 11 = 12345678, 12 = 8888888888; double d1= 2e20, d2 = 124; byte b1 = 1, b2 = 2, b3 = 129; j = j + 10; i i 10; i i* 0.1; char c1= 'a', c2 = 125; byte b = b1 - b2; char c = c1 + c2 - 1; float f3f1 + f2; float f4 f1 + f2 * 0.1; double d float f = d1* i + j; (float) (d1* 5 + d2); Activate Window Go to Settings to activ Create the following classes and then add them to your folder (yourlastname_yourfirstname_hw1). Write a Java class named Problem2. In this class, add a main method that asks the user to enter the amount of a purchase. Then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. Display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax). Write a Java class named Problem3. In this class, add a main method that asks the user for total amount of purchase and computes the tax (assume the tax rate is 7%). Also, ask the user if the product is being shipped to New York. If yes, add an additional shipping fee of $9.99 to the final cost. Display the total cost. Write a Java class named Problem4. In this class, add a main method that asks the user for a letter and checks whether the letter is a vowel or consonant. Activate Win to Settings to Write a Java class named Problem5. In this class, add a main method to input five numbers and only display the even ones if there are any. Write a Java class named Problem6. In this class, add a main method that prompts the user for three numbers then displays them the in descending order. Write a Java class named Problem7. In this class, add a main method that takes a year from user and print out whether that year is a leap year or not. 1. The year can be evenly divided by 4, 2. If the year can be evenly divided by 100, it is NOT a leap year, unless the year is also evenly divisible by 400. Then it is a leap year. Activate Wine Go to Settings to Write a Java class named Problem8. A full-time car salesman gets a flat salary of $10,000 and a commission on car sales. A part-time car salesman gets only commission on car sales. Currently, the commission on sales is 2.5% of the total car sales. In this class, add a main method to ask the user whether the employee is full-time or part-time. Also, ask for the total car sales he/she made that year. Then compute the annual gross pay for that employee and display it.
Step by Step Solution
There are 3 Steps involved in it
Corrected code for the given code with the fixed errors and comments is as below ... View full answer
Get step-by-step solutions from verified subject matter experts
