-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractice.java
31 lines (23 loc) · 958 Bytes
/
practice.java
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
27
28
29
30
31
public class practice{
public static void main(String[] args) {
// This command will call the function getmilk();
int change = getmilk(10, 1000);
System.out.println("Hello Debajit, Take your change of $" +change);
}
// Here we are creating a funtion to fetch milk from the store
/* public static void getmilk(){
System.out.println("Take my money");
System.out.println("Go to the shop");
System.out.println("Buy Some Milk");
System.out.println("& Come back to home");
} */
public static int getmilk(int nrOfCartoonsToBuy, int startingAmount){
int priceToPay = nrOfCartoonsToBuy*10;
System.out.println("Take my money");
System.out.println("Go to the shop");
System.out.println("Buy Milk" +"& No of cartoons are:" +nrOfCartoonsToBuy );
System.out.println("& Come back to home");
System.out.println("The total price of the milk is :" +priceToPay);
return startingAmount - priceToPay;
}
}