Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 438 Weeks Ago, 2 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 11 Jun 2017 My Price 7.00

Car Class Design a class named Car that has the following fields

Car Class Design 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.

Answers

(8)
Status NEW Posted 11 Jun 2017 09:06 AM My Price 7.00

-----------

Attachments

file 1497174843-Answer.docx preview (105 words )
p-----------ubl-----------ic -----------cla-----------ss -----------Car----------- -----------{ /-----------/ c-----------las-----------s v-----------ari-----------abl-----------es -----------int----------- ye-----------arM-----------ode-----------l; -----------Str-----------ing----------- ma-----------ke;----------- in-----------t s-----------pee-----------d; ----------- /-----------/co-----------nst-----------ruc-----------tor----------- -----------pub-----------lic----------- Ca-----------r(i-----------nt -----------yea-----------rMo-----------del-----------, S-----------tri-----------ng -----------mak-----------e) -----------{ t-----------his-----------.ye-----------arM-----------ode-----------l =----------- ye-----------arM-----------ode-----------l; -----------thi-----------s.m-----------ake----------- = -----------mak-----------e; -----------thi-----------s.s-----------pee-----------d =----------- 0;----------- } -----------//a-----------cce-----------sso-----------rs ----------- p-----------ubl-----------ic -----------int----------- ge-----------tYe-----------arM-----------ode-----------l()----------- { -----------ret-----------urn----------- ye-----------arM-----------ode-----------l; -----------} ----------- pu-----------bli-----------c v-----------oid----------- se-----------tYe-----------arM-----------ode-----------l(i-----------nt -----------yea-----------rMo-----------del-----------) {----------- th-----------is.-----------yea-----------rMo-----------del----------- = -----------yea-----------rMo-----------del-----------; }----------- pu-----------bli-----------c S-----------tri-----------ng -----------get-----------Mak-----------e()----------- { -----------ret-----------urn----------- ma-----------ke;----------- } ----------- p-----------ubl-----------ic -----------voi-----------d s-----------etM-----------ake-----------(St-----------rin-----------g m-----------ake-----------) {----------- th-----------is.-----------mak-----------e =----------- ma-----------ke;-----------
Not Rated(0)