Question & Answer: JAVA -EXAM 3 SUMMER 2017 INSTRUCTOR: A. SAHBA NAME 5 2033-SECTION DATE: Il Coding, Analysis, and Interpretation: For a…..

JAVA -EXAM 3 SUMMER 2017 INSTRUCTOR: A. SAHBA NAME 5 2033-SECTION DATE: Il Coding, Analysis, and Interpretation: For all problems follow proper coding guidelines with regard to punctuation, spacing, syntax, etc. Use printfo (with format specifiers as needed) for prompts and output. Do not write in all caps except where permitted according to Java rules. Class programs are programs without a maino. Fields and methods in stand-alone class programs are not static. Application classes are programs with a main). Be sure to exit the main. Unless otherwise indicated, classes and their Test programs are in the same directory. READ carefully all the instructions 31. Car is a class program. Car has a no-args/empty constructor and an overloaded constructor that accepts the year, make, and model and stores each in their respective fields (class-level variables) of the same name. It has a carsBought method that retums the number purchased for that specific year, make, and model through a prompt. Also code a method called objectState that returns the formatted output for the fields according to the specs below. (10 points) FORMATTED OUTPUT SPECS: Year, Make, & Model: 9999 Xxxxxxxxxx Xxxxxxxxx
media%2F9e4%2F9e4d202e-22a9-4faa-ba63-73
Use the first question to answer number 32! Don’t answer 31! Need in 30
Minutes, thank you.

JAVA -EXAM 3 SUMMER 2017 INSTRUCTOR: A. SAHBA NAME 5 2033-SECTION DATE: Il Coding, Analysis, and Interpretation: For all problems follow proper coding guidelines with regard to punctuation, spacing, syntax, etc. Use printfo (with format specifiers as needed) for prompts and output. Do not write in all caps except where permitted according to Java rules. Class programs are programs without a maino. Fields and methods in stand-alone class programs are not static. Application classes are programs with a main). Be sure to exit the main. Unless otherwise indicated, classes and their Test programs are in the same directory. READ carefully all the instructions 31. Car is a class program. Car has a no-args/empty constructor and an overloaded constructor that accepts the year, make, and model and stores each in their respective fields (class-level variables) of the same name. It has a carsBought method that retums the number purchased for that specific year, make, and model through a prompt. Also code a method called objectState that returns the formatted output for the fields according to the specs below. (10 points) FORMATTED OUTPUT SPECS: Year, Make, & Model: 9999 Xxxxxxxxxx Xxxxxxxxx

Expert Answer

 

TestCar.java

class TestCar{

public static void main(String args[]){

Car car1 = new Car(1955,”Ford”,”Thunderbird”);

Car car2 = new Car(1984,”Aston Martin”,”Series 2 DB4″);

printf(“Year, make, & Model : %s n Number Purchased : %s”,car1.carsBought(), car1.objectState());

printf(“Year, make, & Model : %s n Number Purchased : %s”,car2.carsBought(), car2.objectState());

}

}

————————————————————–

PLEASE RATE !!

Still stressed from student homework?
Get quality assistance from academic writers!