answersLogoWhite

0

import java.io.*;

class Shop

{

String code[]=new String[20];

String name[]=new String[20];

float price[]=new float[20];

int i,j;

Shop()

{

i=0;

}

void getitem() throws IOException

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter ItemCode:");

code[i]=br.readLine();

System.out.println("Enter ItemName:");

code[i]=br.readLine();

System.out.println("Enter UnitPrice:");

price[i]=Float.valueOf(br.readLine()).floatValue();

i++;

}

void printitem()

{

System.out.println("\n ItemCode\tItemName\tunitPrice\n");

for(j=0;j<i;j++)

{

System.out.println(code[j]+"\t\t");

System.out.println(name[j]+"\t\t");

System.out.println(price[j]+"\t\t");

}

}

}

class ShopOnl

{

public static void main(String args[]) throws IOException

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

int ch=0;

Shop s=new Shop();

while(ch!=3)

{

System.out.println("1.Get Item");

System.out.println("2.View Bill");

System.out.println("3.Quit");

System.out.println("Enter your choice");

ch=Integer.parseInt(br.readLine());

switch(ch)

{

case 1:

s.getitem();

break;

case 2:

s.printitem();

break;

case 3:

System.out.println("Thank you! visit again");

break;

}

}

}

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Write an assembly language program to print a to z on screen?

write a program to print A to Z on screen in c?


Write a unix program to print print a pattern?

echo 'print a pattern'


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


Write a C program to print the following series 112 122 . 1n2?

write a program to print the series 1/12+1/22+.........+1/n2 ?


Write a c program that outputs minimum no of currency notes required for given amount at input?

#include&lt;stdio.h&gt; main() { int a; print f("enter your amount "); scan f("%d",&amp;a); }


Write a c program to print Bangalore is a beautiful place?

I am very tempted to write a program to display something rude about your teacher to get you in trouble. I have chosen not too but will give you a hint that will require you to do a small amount of reading and a small amount of thinking. Hello world Programming require reading and thinking, get used to it.


Write a c-program to compute compound interest after accepting the principal amount rate and time from user?

#this program to calculate princple amount using perl. print "enter the amount given;","\n"; $A=&lt;stdin&gt;; print "enter the rate of interst given;","\n"; $R=&lt;stdin&gt;; print "enter the no of years given;","\n"; $Y=&lt;stdin&gt;; $o=1+$R; $e=$o**$Y; $t=1/$e; $f=1-$t; $p= $A*$f; print "princple amount $p";


Write a program to print the sum of a sparse matrix?

This is a directive, not a question.


Write a c program to print roman letters?

good morning


Can you Write a program in 'c' to print symbols of playing cards?

Yes.


Write c program to print?

include &lt;stdio.h&gt; int main (void) { puts ("print"); return 0; }


Q2 Write a program to print even numbers between 10 and 50?

You can use int i; for (i = 10; i &lt;= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.