Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A class describes objects with the same behavior. For example, a CarPricing class describes the pricing of passenger vehicles that have certain prperties and

image text in transcribedimage text in transcribed

A class describes objects with the same behavior. For example, a CarPricing class describes the pricing of passenger vehicles that have certain prperties and car options Media Bakery. Slide Type Fragment The CarPricing class allows the user to start entering car properties and options at a used cars dealership with the objective of describing available car properties and computing the total price of a car . As in the real car dealing, options play a major role in detrmining the car price .The class public interface has the following methods: init constructor method: initializes all instance variables for the car to be priced carDescription which is a list of strings containing make (like Toyota). model (like Camry), color, and year. Another instance vanable is the basic price of the car. The last instance vanable is the list of strings containing car options (includes one or more of the following Sunroof, Stereo, Camera System, Leather Seats Automatic Seats, Laser System). If the car is basic, this list should be empty. computeCost method: computes the car total cost given its basic price plus the price for options: All options cost 2000 Riyals, each, except for Leather Seats and Sunroofs, which cost 4000 Riyals, each printProperties method prints car description as shown in the sample run printOptions method prints all the options of the car that is being processed. If the car has no options, it prints "no options" as shown in the sample run. .getBasicPrice method returns the basic price. . When testing your CarPricing class create an empty list of CarPricing objects. Then add to it 3 CarPricing objects with description and options as shown in the sample run below. After that use a loop to display their descriptions, options and prices as shown in the sample run below. You need also to display the total price of all cars. You have to use all methods defined in CarPricing class when testing your class except for init method which is called automatically when creating a carPricing object.

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

Fundamental Financial Accounting Concepts

Authors: Thomas Edmonds, Christopher Edmonds

9th edition

9781259296802, 9781259296758, 78025907, 1259296806, 9781259296765, 978-0078025907

Students also viewed these Accounting questions