Question: Please submit your codes for the 5 exercises from chapters 3 and 4 . You are advised to have the codes completed on Eclipse and

Please submit your codes for the 5 exercises from chapters 3 and 4.
You are advised to have the codes completed on Eclipse and have your .java files ready.
Question 1:
(Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information
as instance variables-a part number (type String), a part description (type String), a quantity of the item being purchased (type int) and a price per item (double).
Your class should have a constructor that initializes the four instance variables.
Provide a set and a get method for each instance variable.
If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.0.
In addition, provide a method named get/nvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as
a double value.
Write a test app named InvoiceTest that demonstrates class Invoice's capabilities.
Question 2:
(Employee Class) Create a class called Employee that includes three instance variables-a first name (type String), a last name (type String) and a monthly salary (double).
Provide a constructor that initializes the three instance variables.
Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value.
Write a test app named EmployeeTest that demonstrates class Employee's capabilities. Create two Employee objects and display each object's yearly salary. Then give each
Employee a 10% raise and display each Employee's yearly salary again.
Question 3:
(Gas Mileage) Drivers are concerned with the mileage their automobiles get. One driver has kept track of several trips by recording the miles driven and gallons used for each tankful.
Develop a Java application that will input the miles driven and gallons used (both as integers) for each trip.
The program should calculate and display
the miles per gallon obtained for each trip
print the combined miles per gallon obtained for all trips up to this point.
All averaging calculations should produce floating-point results.
Use class Scanner and sentinel-controlled repetition to obtain the data from the user.
Hint: you can use mile variable as sentinel. Quit when it is -1.
Question 4:
(Find the Largest Number) The process of finding the largest value is used frequently in computer applications.
For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the
contest.
Write a Java application that inputs a series of 10 integers and determines and prints the largest integer.
Your program should use at least the following three variables:
counter: A counter to count to 10(i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed).
number: The integer most recently input by the user.
largest: The largest number found so far.
Question 5:
(Sides of a right triangle) Write an application that reads three nonzero integers and determines and prints whether they could represent the sides of a right triangle. (Make it easy to read please thank you!)
Please submit your codes for the 5 exercises from

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!