Answer ALL questions in this section. This section relates to the Java programming language Questions in this section re
Posted: Sat May 14, 2022 2:58 pm
case study is also given answer these fast
Answer ALL questions in this section. This section relates to the Java programming language Questions in this section relate to the Case Study A provided with this assignment Questions 16 - 22 are multiple choice questions and each has only ONE correct answer. ONLY enter A-E. You will get zero marks if you enter more than one answer. 16 Which of the following is TRUE: a) Car is a client of both GarageList and CarTest b) Car is a client of GarageList and a supplier to Date c) Car is a supplier to both CarTest and Date d) Car is a supplier to both CarTest and GarageList e) Car is a supplier to Date and a client of CarTest Your answer letter: 17 Which of the following is FALSE, for code which could be added to Car a) String owner would declare a field b) public void payCost(float amount) would be the signature of a mutator c) public Car setCar()would be the signature of a constructor d) public int getCostPaid() would be the signature of an accessor e) String Date scrapped = new Date(1,1,2021) would declare a field Your answer letter: 18 Which of the following is TRUE a) An accessor USUALLY changes field values b) A mutator NEVER changes field values c) A constructor NEVER changes field values d) A mutator USUALLY returns a value e) A constructor NEVER returns a value Your answer letter:
SECTION B Case Study A This section relates to the Java programming language. TestRunner ListRunner Cartes Garage List Car . Date public class Car { private String regNo; private String make; private Date registered; private int milage; private double cost; private double costPaid; public Car (String reg, String mk, int mls) { make = mk; regNo = reg; milage = 0; cost = 0; cost Paid = 0; registered = null; ) public String getRegistration () { return regno; } public void setCost (double f) { cost = } //remaining code omitted but could include: Car(), updateMilage (), toString(), getMake () and other accessors/mutators/constructors } // continued below
public class GarageList private String name; private int areaCode; private ArrayList<Car> carlist = new ArrayList<Car>(); public GarageList(String nme, int cd) name = nme; areaCode = cd; } public void addCar (Car s) 1 carList.add(s); } public Car findCar (String cNo) { for (int index = 0; index < carlist.size(); index++) { Car temp = carlist.get (index); tempreg = temp.getRegistration (); if (cNo.equals (tempReg)) { return temp; } return null; //remaining code omitted 1/re
Answer ALL questions in this section. This section relates to the Java programming language Questions in this section relate to the Case Study A provided with this assignment Questions 16 - 22 are multiple choice questions and each has only ONE correct answer. ONLY enter A-E. You will get zero marks if you enter more than one answer. 16 Which of the following is TRUE: a) Car is a client of both GarageList and CarTest b) Car is a client of GarageList and a supplier to Date c) Car is a supplier to both CarTest and Date d) Car is a supplier to both CarTest and GarageList e) Car is a supplier to Date and a client of CarTest Your answer letter: 17 Which of the following is FALSE, for code which could be added to Car a) String owner would declare a field b) public void payCost(float amount) would be the signature of a mutator c) public Car setCar()would be the signature of a constructor d) public int getCostPaid() would be the signature of an accessor e) String Date scrapped = new Date(1,1,2021) would declare a field Your answer letter: 18 Which of the following is TRUE a) An accessor USUALLY changes field values b) A mutator NEVER changes field values c) A constructor NEVER changes field values d) A mutator USUALLY returns a value e) A constructor NEVER returns a value Your answer letter:
SECTION B Case Study A This section relates to the Java programming language. TestRunner ListRunner Cartes Garage List Car . Date public class Car { private String regNo; private String make; private Date registered; private int milage; private double cost; private double costPaid; public Car (String reg, String mk, int mls) { make = mk; regNo = reg; milage = 0; cost = 0; cost Paid = 0; registered = null; ) public String getRegistration () { return regno; } public void setCost (double f) { cost = } //remaining code omitted but could include: Car(), updateMilage (), toString(), getMake () and other accessors/mutators/constructors } // continued below
public class GarageList private String name; private int areaCode; private ArrayList<Car> carlist = new ArrayList<Car>(); public GarageList(String nme, int cd) name = nme; areaCode = cd; } public void addCar (Car s) 1 carList.add(s); } public Car findCar (String cNo) { for (int index = 0; index < carlist.size(); index++) { Car temp = carlist.get (index); tempreg = temp.getRegistration (); if (cNo.equals (tempReg)) { return temp; } return null; //remaining code omitted 1/re