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 exercises from chapters and
You are advised to have the codes completed on Eclipse and have your java files ready.
Question :
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 variablesa 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 If the price per item is not positive, it should be set to
In addition, provide a method named getnvoiceAmount that calculates the invoice amount ie 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 :
Employee Class Create a class called Employee that includes three instance variablesa 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 raise and display each Employee's yearly salary again.
Question :
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 floatingpoint results.
Use class Scanner and sentinelcontrolled repetition to obtain the data from the user.
Hint: you can use mile variable as sentinel Quit when it is
Question :
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 integers and determines and prints the largest integer.
Your program should use at least the following three variables:
counter: A counter to count to ie to keep track of how many numbers have been input and to determine when all numbers have been processed
number: The integer most recently input by the user.
largest: The largest number found so far.
Question :
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!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
