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 missile weighs 40 000 lb. The constant thrust provided by the turbojet engine is T = 15 000 lb. Additional thrust is provided by two rocket boosters B. The propellant in each booster is burned at...
-
Foxcomp, an electronics and computer manufacturer with a global supply chain, wants to add a new supplier for some of its component parts, and the suppliers it's considering are in Taiwan, India,...
-
Water at \(400 \mathrm{psi}\) is available to operate a turbine at 1750 \(\mathrm{rpm}\). What type of turbine would you suggest to use if the turbine should have an output of approximately \(200...
-
Which of the following bonds offers the highest current yield? a. A 91/2%, 20-year bond quoted at 973/4 b. A 16%, 15-year bond quoted at 1645/8 c. A 51/4%, 18-year bond quoted at 54
-
A discussion of THREE separate ESG issues from Air canada company's report, one each addressing Environmental (CHAR), Social and Governance issues. Evaluate how each issue relates to the disclosure...
-
Determine the forces in members AB , AC , and AD . Point M is the centroid of triangle BCD . The forces are positive if in tension, negative if in compression. B 5.2' M 5.2' 1190 lb x D 5.2 6.6'
-
If we will use the standard parts and purchase in bulk it will reduce the cost of the direct material by 10 and will reduce the unallocated cost by 25000
-
Investors in the JMJ Group purchased a hotel restort in April. The group paid $20 million for the hotel resort and $5 million for the grounds surrounding the resort. The group sold the resort 5 years...
-
Design a project of your own choice and show the following contents thereof 1. Name or identity of your project (1 Marks) 2. Support your project by clearly defining the concepts 'project' and...
-
If there is a serious mishap at a worksite, who in particular must be notified under the federal or state requirements? 1. What do we do about OSHA reporting requirements in a state with a federally...
-
The bonds of Simons, Inc. carry a 89 monthly coupon and mature in six years. Bonds of equivalent risk yield 9.5% What is the market value of Simons's bonds? (4 points) The bonds of Simons, Inc. carry...
-
The entity conducted an independent appraisal of the value of its real estate in accordance with previously applicable national rules. The entity's financial analysts determined that the values had...
-
You are tasked to design and select the lightest W-section (W8-W14 only) for the main members of the buildings which includes (the number represents the coding on the diagram provided): Beam (5) ...
-
What are the risks and liability factors in an audit? What are the implications to the auditor? What are the implications to the organization? How can the auditor mitigate these risks and liability...
-
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...
-
When a contracting hot ball of gas spins into a disk shape, it cools faster due to (a) increased radiation transfer. (b) increased surface area. (c) decreased insulation. (d) increased convection...
-
The Sun contains what percentage of the solar systems mass? (a) about 35% (b) 85% (c) the percentage varies over time (d) over 99%
-
The nebular theory is based on the observation that the solar system (a) follows patterns indicating that it formed progressively from physical processes. (b) has a structure much like an atom. (c)...
Study smarter with the SolutionInn App