java program
Exercise 1A) Write a class called SportsCar containing the two instance variables maxSpeed and horsepowerof type int. Both these instance variables must, in any SportsCar object hold values that are greater than certain pre-specified values; otherwise, they do not qualify as proper SportsCarobjects. In our case, the minimum value for maxSpeed is 200 km/hour, and the minimum value for horsepower is 250hp. Include suitable member variables in the SportsCar class to hold these values (maxSpeedRequirement and horsepowerRequirement) and write a method called SportsCheck that returns true if both of the maxSpeed and horsepower for a particular SportsCar object are above the minimum requirements; otherwise false. Write accessor and mutator methods for maxSpeed, horsepower, maxSpeedRequirement and horsepowerRequirement.
Exercise 2A) Write a class called Robot with the following three instance variables: name (string), age (ushort), isOn (bool). Make the program initialize the instance variables to unknown, 0, and false, respectively (without using constructors). Include accessor and mutator methods to assign and retrieve the values of these instance variables. B) Allow the users of the Robot class to set the initial values of the three instance variables when a Robot object is created. To this end declare one constructor with three formal parameters and one default constructor.C) Include a member variable called robotsCreated that keeps track of the number of Robot objects created. Make the constructors update the robotsCreated variable so it is always up to date. Implement the following logic: If robotsCreated is less than 5 when the constructor is called, set isOn to true; otherwise false.
You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.
Latest completed orders:
# | topic title | discipline | academic level | pages | delivered |
---|---|---|---|---|---|
6
|
Writer's choice
|
Business
|
University
|
2
|
1 hour 32 min
|
7
|
Wise Approach to
|
Philosophy
|
College
|
2
|
2 hours 19 min
|
8
|
1980's and 1990
|
History
|
College
|
3
|
2 hours 20 min
|
9
|
pick the best topic
|
Finance
|
School
|
2
|
2 hours 27 min
|
10
|
finance for leisure
|
Finance
|
University
|
12
|
2 hours 36 min
|