It is very important that you read the notes at the end of each assignment for t
ID: 656104 • Letter: I
Question
It is very important that you read the notes at the end of each assignment for this and all other assignments.
Develop a functional flowchart and then write a C++ program as explained below. You will be using classes and objects, and appropriate member functions, constructors, destructor, etc. to handle the tasks outlined below.
The class will be named Car and will contain the following data members (in the private access region):
Manufacturer - Car Manufacturer
Model - Car Model
Type - Car Disk Type
Price - Car Price
Serial Number - Car Serial Number
Warranty - Car Warranty period
Rebate - Car Rebate, if any
You will determine the type of data to be used for each data member.
After the declaration of the class, declare two objects for the class Car named Car1 and Car2. Initialize Car1 via the class constructor, using specifications for the Car1. Prompt the user to provide the necessary data for the Car2. The default constructor will be used initially for Car2. Your program will then display the information about the Cars in a tabulated format as shown below. You will need to define and implement all of the needed accessor, mutator, and helper member functions. No global functions to be used in this assignment.
Car1 Car2
Manufacturer
Model
Type
Price
Serial Number
Warranty
Rebate
Grading:
Flowchart 7 points
Choice of data selected 7 points
Documentation 10 points
Proper development of class
and member functions 40 points
Program completeness 30 points, this includes program correctness, efficient programming, using right constructs for the solution, and proper use of coding as emphasized in class
Sample correct outputs 6 points
Notes:(please read very carefully)
1. Make sure your files are VIRUS FREE!(grade of 0 will be given for infected media). Use Technology lab PCs for the test.
2. Comment your program.
3. Use meaningful prompts.
4. Provide a brief description of the problem being solved.
5. Be sure to include a header file at the beginning of your program as shown in the course syllabus.
6. NO global declarations allowed, except for the class and function prototypes.
7. Use classes, member functions, date members, and strings.
8. Full member -function prototyping is required. Member functions must have their purposes fully explained.
8A. No member function should be defined within a class (i.e., no
Explanation / Answer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public class Car
{
private String make;
private String model;
private int year;
public Car(String make,String model,int year)
{
this.make = make;
this.model= model;
this.year = year;
}
public String setCarMake(String make)
{
this.make = make;
return make;
}
public String getCarMake()
{
return make;
}
public String setCarModel(String model)
{
this.model = model;
return model;
}
public String getCarModel()
{
return model;
}
public int setCarYear(int year)
{
this.year = year;
return year;
}
public int getCarYear()
{
return year;
}
public String toString()
{
return "Car make: " + make + "
Car model: " + model + " Car Year:" + year;
}
public static void main (String[] args)
{
Car car1 = new Car("Toyota", "Corolla" , 1996);
Car car2 = new Car("Nissan", "Murano" , 2004);
Car car3 = new Car("Infinity", "Mazda" , 2013);
car1.setCarMake("BMW");
System.out.println(car1);
System.out.println(car1.getCarYear());
car2.setCarModel("Altima");
System.out.println(car2);
System.out.println(car2.getCarMake());
car3.setCarYear(2012);
System.out.println(car3);
System.out.println(car3.getCarModel());
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public class Car
{
private String make;
private String model;
private int year;
public Car(String make,String model,int year)
{
this.make = make;
this.model= model;
this.year = year;
}
public String setCarMake(String make)
{
this.make = make;
return make;
}
public String getCarMake()
{
return make;
}
public String setCarModel(String model)
{
this.model = model;
return model;
}
public String getCarModel()
{
return model;
}
public int setCarYear(int year)
{
this.year = year;
return year;
}
public int getCarYear()
{
return year;
}
public String toString()
{
return "Car make: " + make + "
Car model: " + model + " Car Year:" + year;
}
public static void main (String[] args)
{
Car car1 = new Car("Toyota", "Corolla" , 1996);
Car car2 = new Car("Nissan", "Murano" , 2004);
Car car3 = new Car("Infinity", "Mazda" , 2013);
car1.setCarMake("BMW");
System.out.println(car1);
System.out.println(car1.getCarYear());
car2.setCarModel("Altima");
System.out.println(car2);
System.out.println(car2.getCarMake());
car3.setCarYear(2012);
System.out.println(car3);
System.out.println(car3.getCarModel());
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.