Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TOTAL MARKS [100 MARKS] QUESTION 1 [30 Marks] Transform the UML diagram in Figure 1 into Java class definition Vehicle. The UML diagram describes sales

image text in transcribed

image text in transcribed

TOTAL MARKS [100 MARKS] QUESTION 1 [30 Marks] Transform the UML diagram in Figure 1 into Java class definition Vehicle. The UML diagram describes sales between seller and buyer. Buyer has options to choose either to buy vehicle with price or with addons. VehicleSales +static void main(String[] args) Vehicle -final double price -final double GPS -- final double stereo -double totalprice int size -String addOnNum -int choice + Vehicle(int ch, int qty) + Vehicle(int ch, int qty, String addon) + void calculateTotalPrice() +double getTotalPrice() Figure 1 QUESTION 3 35 Marks] 1) public class MetBuilding { public int sqrFeet; private String name; BCS2143 Page 2 of 3 MODEL EXAM protected double cost; public MctBuilding0 {} protected boolean isBuilt( {...} public void moveIn() { ... } public double rentSpace() {...} private int renovate int days) {...} a. Which members are visible to accessible from) MetBuilding and its subclasses? [1 mark] b. Which members are visible only to accessible from) the MetBuilding class? [1 mark] c. Which members are visible to (accessible from) any class? [1 mark] d. For which field(s) we should write getter(s) and setter(s) for, so classes outside MetBuilding and its inheritance hierarchy can access it(them)? [1 mark] e. Write default constructor and what is its purpose? [1 Mark] 12 Marks] [ Does default constructor return any value? Justify. [8 Marks/ 2) Define the following terms used in Java? al this b) super d fina d) Lecture chapter 3) Write program for udd, subtract, multiply, divide in a calculator application 120 Marks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions