• A class describes objects with the same behavior . For example, a Car Pricing class describes the pricing of passenger

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

• A class describes objects with the same behavior . For example, a Car Pricing class describes the pricing of passenger

Post by answerhappygod »

A Class Describes Objects With The Same Behavior For Example A Car Pricing Class Describes The Pricing Of Passenger 1
A Class Describes Objects With The Same Behavior For Example A Car Pricing Class Describes The Pricing Of Passenger 1 (86.53 KiB) Viewed 32 times
A Class Describes Objects With The Same Behavior For Example A Car Pricing Class Describes The Pricing Of Passenger 2
A Class Describes Objects With The Same Behavior For Example A Car Pricing Class Describes The Pricing Of Passenger 2 (45.3 KiB) Viewed 32 times
• A class describes objects with the same behavior . For example, a Car Pricing class describes the pricing of passenger vehicles that have certain peperties 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 cat . 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 variable 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 compules 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 Car Pricing class create an empty list of CarPricing objects. Then add to it 3 Car Pricing 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
Slide Type 11 your code for Carricing class here Slide Type your code for testing carpricing class here elow is the output generated by the code testing your carpricing class Honda Accord Blue 2021 Car Options: Sunroof Stereo Camera Systen Leather Seats Car basic cost - 70000 Car total price - 12000 Toyota Camry Alpine White 2020 Car Options: no options Car basic cost = 55000 car total price - 55000 Honda Civic Metalic Black 2020 car options: Sunroof Stereo Camera system Leather Seats Laser System Car basic cost toeee car total price - 74000 Sum of processed car prices - 211000 Side Type
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply