-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCarDealership.java
More file actions
26 lines (20 loc) · 817 Bytes
/
CarDealership.java
File metadata and controls
26 lines (20 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.codefortomorrow.beginner.chapter4.solutions;
/**
* @author ArmeetJatyani
* March 2021
*
* Manage a car dealership and take inventory of all cars sold!
*/
public class CarDealership {
public static void main(String[] args) {
// write your code here
// define 3 integer constants, representing the prices of 3 cars sold in USD (line 15-17)
final int car1 = 30000;
final int car2 = 24650;
final int car3 = 253630;
// define an integer variable, which represents the sum of the prices of these 3 cars (line 20)
int revenue = car1 + car2 + car3;
// print out the formatted revenue after selling these 3 cars, output: "I sold 3 cars for $XXXXXX." (line 23)
System.out.println("I sold 3 cars for $" + revenue + ".");
}
}