Skip to content

Commit 3c4a093

Browse files
committed
finished CarDealership exercise
1 parent b9f1238 commit 3c4a093

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.codefortomorrow.beginner.chapter4.practice;
2+
3+
/**
4+
* @author ArmeetJatyani
5+
* March 2021
6+
*
7+
* Manage a car dealership and take inventory of all cars sold!
8+
*/
9+
10+
public class CarDealership {
11+
public static void main(String[] args) {
12+
// write your code here
13+
14+
// define 3 integer constants, representing the prices of 3 cars sold in USD (line 15-17)
15+
16+
17+
18+
19+
// define an integer variable, which represents the sum of the prices of these 3 cars (line 20)
20+
21+
22+
// print out the formatted revenue after selling these 3 cars, output: "I sold 3 cars for $XXXXXX." (line 23)
23+
24+
25+
26+
}
27+
}
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.codefortomorrow.beginner.chapter4.practice;
2+
3+
/**
4+
* @author ArmeetJatyani
5+
* March 2021
6+
*
7+
* Manage a car dealership and take inventory of all cars sold!
8+
*/
9+
10+
public class CarDealership {
11+
public static void main(String[] args) {
12+
// write your code here
13+
14+
// define 3 integer constants, representing the prices of 3 cars sold in USD (line 15-17)
15+
final int car1 = 30000;
16+
final int car2 = 24650;
17+
final int car3 = 253630;
18+
19+
// define an integer variable, which represents the sum of the prices of these 3 cars (line 20)
20+
int revenue = car1 + car2 + car3;
21+
22+
// print out the formatted revenue after selling these 3 cars, output: "I sold 3 cars for $XXXXXX." (line 23)
23+
System.out.println("I sold 3 cars for $" + revenue + ".");
24+
25+
26+
}
27+
}
28+

0 commit comments

Comments
 (0)