Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Class car String make: int price public Car (String m, int p)f price P double calculateDiscountPrice (double rate) f double disPrice price -(price

image text in transcribed
Question 1: Class car String make: int price public Car (String m, int p)f price P double calculateDiscountPrice (double rate) f double disPrice price -(price rate) return diaPzice public String sastxina0 String detailsmake+ price"KD" return detaiis Give the above class Car, write a main class to do the following: 1. Create an empty array list of cars 2. Write a loop to allow the user to add exactly five different cars in the array list. B. Write java statement to print out the make of the first car in the array list. 4. Write java statement to print out the price of the last car in the array list. 5. Write java statement to print out the details of the third object in the array list 6, write java statement to calculate the price of the fourth car after a discount of 20%. 7. Write a loop to print out the details of each car in the array list along with its price after a discount 10%. 8. Write a loop to print out the total price for all cars in the array ist 9. Write a loop to check and print out if the array ist has BMW car or not 10 Write a loop to print out the make of the cars that are les than 10,000KD 11 Write a loop to find the most expensive ear in the array list, and pint out its detas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions