Please see the class below and explain why each line of code is correct or incorrect....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Corrected code for the given code with the fixed errors and comments is as below ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
A prime number is a natural number that has only one and itself as factors. 2, 3, 5, 7, 11, and 13 are a few prime numbers. The above numbers can only be divided evenly by 1 or itself, so these...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
I need a new/different perspective on this initial discussion post. Thanks. Tommy Teenager (TT) is an enthusiastic, new employee at a local grocery store, Food Fetch (FF). His boss is Mary Manager...
-
Calculate the oscillating frequency of a FET Hartley oscillator with C = 250pF, L1 = L2 = 1.5 mH, and mutual inductance between L1 and L2 is 0.5 mH.
-
The following data are for Marvin Department Store. The account balances (in thousands) are for 2017. Marketing, distribution, and customer-service costs............................$ 37,000...
-
From August 2014 to August 2017, the Fed continued to reiterate that monetary policy was accommodative. And during this time, excess reserves by banks decreased from around \($2.67\) trillion to...
-
Implement a sampler that samples from the Chinese restaurant process. Repeatedly resample assignment of customers to tables and plot a histogram over the number of tables. Investigate how the...
-
Dexter Products, Inc., manufactures and sells a number of items, including an overnight case. The company has been experiencing losses on the overnight case for some time, as shown on the following...
-
3. [16%] The bank statement for Gatlin Co. indicates a balance of $7,735.00 on June 30, 2010. After the journals for June had been posted, the cash account had a balance of $4,098.00. Prepare a bank...
-
Monthly return data are presented below for each of three stocks and the S&P index (corrected for dividends) for a 12-month period. Calculate the following quantities: - Alpha for each stock - Beta...
-
Question 5 The management of Madeira Manufacturing Company is considering the introduction of a new product. The fixed cost to begin the production of the product is $30,000. The variable cost for...
-
What factors should an entrepreneur consider when differentiating between CVC and VC investors?
-
Describe an investment opportunity that includes at least one real option. On what does the value of the option depend?
-
Liquidation preferences and participation are both common features of term sheets. How do these provisions work when there is a liquidation event like a winding up of the company or an acquisition?
-
What is hypothesis-driven entrepreneurship and how does it relate to real options? What are some examples of real options?
-
What are three important differences between real options and financial options?
-
LO 5 Portsmouth Company makes upholstered furniture. Its only variable cost is direct materials. The demand for the company's products far exceeds its manufacturing capacity. The bottleneck (or...
-
In your readings, there were many examples given for nurturing close family relationships in this ever-evolving technological society we live in Based upon your readings and research describe three...
-
Mike purchases a heavy-duty truck (5-year class recovery property) for his delivery service on April 30, 2012. The truck is not considered a passenger automobile for purposes of the listed property...
-
Carl Conch and Mary Duval are married and file a joint return. They live at 1234 Mallory Sq. Apt. 64, Key West, FL 33040. Carl works for the Key Lime Pie Company and Mary is a homemaker after losing...
-
Ann hires a nanny to watch her two children while she works at a local hospital. She pays the 19-year-old nanny $125 per week for 48 weeks during the current year. a. What is the employer's portion...
-
Using the Internet, search for the terms "litiga- tion support" and "litigation services" and visit five or six sites that involve forensic accounting services. Also explore several sites involving...
-
Using the Internet, examine how WorldCom cooked its books.
-
Using the Internet, visit the Kessler Interna- tional website and read some of the stories in "Kessler in the News." Who was the first "forensic auditor"?
Study smarter with the SolutionInn App