0% found this document useful (0 votes)
10 views3 pages

URK18CS138

dsd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

URK18CS138

dsd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

import java.util.

Scanner;

public class CCD {


float coffee;
float milkshake ;
float cake ;
int coffee1;
int milkshake1;
int cake1;
int a ;
char b;
int d , e, f;
int c=1 ;
Scanner scn = new Scanner (System.in);
void get_price()
{
System.out.println("Enter the price of the products (coffee , milkshake , cake)");
coffee = scn.nextFloat();
milkshake = scn.nextFloat();
cake = scn.nextFloat();

}
void get_order()
{
do
{
System.out.println("Enter the product you want \n 1.Coffee \n 2.Milkshake \n 3.Cake \n
4.Exit)");
a = scn.nextInt();

switch(a)
{
case 1 :
System.out.println("How many ?");
coffee1= scn.nextInt();
break;
case 2 :
System.out.println("How many ?");
milkshake1= scn.nextInt();
break;
case 3 :
System.out.println("How many ?");
cake1 = scn.nextInt();
break;
case 4 :
break;
}
System.out.println("Do you want to continue y|n");
b = scn.next().charAt(0);
if (b=='n')
c=0;
}while(c!=0);

}
void display()
{
System.out.println("PRODUCT\t|PRICE\t|STOCK");
System.out.println("COFFEE\t|"+coffee+"\t|10");
System.out.println("SHAKE\t|"+milkshake+"\t|10");
System.out.println("CAKE\t|"+cake+"\t|10");
}
void after_order()
{
d = 10 -coffee1;
e = 10 - milkshake1;
f = 10 - cake1;
System.out.println("PRODUCT\t|PRICE\t|STOCK\t|TOTAL\n-------------------------------");
System.out.println("COFFEE\t|"+coffee+"\t|"+d+"\t|"+coffee1*coffee);
System.out.println("SHAKE\t|"+milkshake+"\t|"+e+"\t|"+milkshake*milkshake1);
System.out.println("CAKE\t|"+cake+"\t|"+f+"\t|"+cake*cake1);
}

public static void main (String[] args)


{
CCD ccd = new CCD();
ccd.get_price();
ccd.get_order();
ccd.after_order();
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy