Write a program in java to print amount of cable bill?

Java

1 answer

Answer

1191386

2026-08-08 00:26

+ Follow

Java
Java

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;

}

}

}

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.