subject

Write a class named car that has the following fields: • yearmodel: the yearmodel field is an int that holds the car's year model. • make: the make 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 brake 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 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. sample run java car 5↵ 10↵ 15↵ 20↵ 25↵ 20↵ 15↵ 10↵ 5↵ 0↵

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
question
Computers and Technology, 23.06.2019 02:50
Define a class named movie. include private fields for the title,year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie.write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields.this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie.settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie.setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie.setdirector(temp); //display all the data myfavoritemovie.displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie.cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
You know the right answer?
Write a class named car that has the following fields: • yearmodel: the yearmodel field is an int...
Questions
question
Mathematics, 04.12.2020 23:50
question
Business, 04.12.2020 23:50
question
Biology, 04.12.2020 23:50
Questions on the website: 13722360