# Solution Write the solution algorithms and the corresponding flowcharts

35.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

## Description

Write the solution algorithms and the corresponding flowcharts to solve each one of the following two problems:

1. Car ClassDesign a class named Car that has the following fields:yearModel: The yearModel field is an Integer that holds the car’s year model.make: The make field references a String that holds the make of the car.speed: The speed field is an Integer that holds the car’s current speed.In addition, the class should have the following constructor and other 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.Accessors: Design appropriate accessor methods to get the values stored in an object’s yearModel, make, and speed fields.accelerate: The accelerate method should add 5 to the speed field each time it is called.brake: The brake method should subtract 5 from the speed field each time it is called.Next, design a program that creates a Car object, and then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brake method five times. After each call to the brake method, get the current speed of the car and display it.

2. Employee and ProductionWorker Classes Design an Employee class that has fields for the following pieces of information:
•Employee name
•Employee numberNext, design a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to hold the following information:
•Shift number (an integer, such as 1, 2, or 3)
•Hourly pay rateThe workday is divided into two shifts: day and night. The shift field will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Design the appropriate accessor and mutator methods for each class.Once you have designed the classes, design a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s fields. Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the screen.

Submission Requirements:

Create a word document including the class table, the class diagram, the algorithms, the flowcharts, and the output generated for each problem

• Write-the-solution-algorithms-and-the-corresponding-flowcharts-to-solve-each-one-of-the-following-two-problems.docx