Retail Transaction Programming Project

computer science


1. Write a class  named  Car that has the following fields:

  •  year model: The yearModel field is an int that holds the car's year model.
  •  make: The made field is a String object that holds the make of the car.
  •  speed: The speed field is an int that holds the car's current speed.
In addition, the class  should have the following methods :
  • Constructor: The constructor should accept the car's year model and make as arguments.
These values should be assigned to the object 's yearModel and make fields. The constructor
should also assign  0 to the speed field.
  •  Accessor: The appropriate accessor methods  should be implemented to access the values stored
in the object 's yearModel, make, and speed fields.
  •  accelerate: The accelerate method should add 5 to the speed field when it is called.
  •  brake: The braking method should subtract 5 from the speed field each time it is called.
Demonstrate the class  in a program  that contains a Car object, and then calls the 
accelerate method five times. After each call to the accelerate method, get the current
the speed of the car and print it on a separate line. Then, call the brake method  five times,
each time printing the current speed of the car on a separate line.
  •  name: a String  containing the employee's name 
  •  idNumber: an int  representing the employee's ID number
  •  rate: a double  containing the employee's hourly pay rate
  •  hours: an int  representing the number of hours this employee has worked
  • The class  should also have the following methods :
  •  Constructor: takes the employee's name  and ID number as arguments 
  •  Accessors: allow access to all of the fields of the Payroll class 
  •  Mutators: let the user assign  values  to the fields of the Payroll class 
  •  grossPay: returns the employee's gross pay, which is calculated as the number of 
hours worked times the hourly pay rate.
Write another program  that demonstrates the class  by creating a Payroll object, then
asking the user to enter the data for an employee in the order: name, ID number, rate, hours.
The program  should then print out a statement  in the following format (for example, if
you had an employee named  Chris Jacobsen with ID number 11111, who works for 5 hours at 
Chris Jacobsen, employee number 11111, made $50.00 in gross pay.
Using text forming so that the gross pay is rounded to two decimal places. 
Write a class  that has three overloaded static  methods  for calculating the areas of the
following geometric shapes:
- circles
- rectangles
- cylinders
Here are the formulas for calculating the area of the shapes. 
Area of a circle: Area = π r2
where p is Math.PI and r is the circle's radius
Area of a rectangle: Area = Width x Length
Area of a cylinder: Area = π r2 h
where p is Math.PI, r is the radius of the cylinder's base, and
his the cylinder's height
Because the three methods are to be overloaded, they should each have the same name, but different
 parameter lists. Demonstrate the class  in a complete program .

  •  length - an int  containing the tract's length
  •  width - an int  containing the tract's width
The class  should also have the following methods : 
  •  area - returns an int  representing the tract's area
  •  equals  - takes another LandTract object  as a parameter  and returns a boolean  saying 
whether  or not the two tracts have the same dimensions (This applies regardless of whether  the dimensions match up. i.e., if the length of the first is the same as the width of the other and vice versa, that counts as having equal  dimensions.)
  •  toString - returns a String  with details about the LandTract object  in the format:
A LandTract object  with length 30 and width 40
(If, for example, the LandTract object  had a length of 30 and a width of 40.)
Write a separate program  that asks the user to enter the dimensions for the two tracts of 
land (in the order length of the first, width of the first, length of the second, the width of the second). The program should print the output of two tracts' toString methods followed by a sentence stating whether or not the tracts have equal dimensions. (If the tracts have the same dimensions, print, "The two tracts have the same size." Otherwise, print, "The two tracts do not have the same size.") Print all three statements on separate lines.

2.Design a Payroll class  with the following fields:

3. Area Class 

4. Make a LandTract class  with the following fields:

Instruction Files

Related Questions in computer science category

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.