answersLogoWhite

0


Best Answer

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

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

import java.io.*;

class ShopReceipt

{

protected static void main()throws IOException

{

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

System.out.print("Enter the no. of types of Items Purchased: ");

byte z=Byte.parseByte(in.readLine());

String n[]=new String[z];

byte q[]=new byte[z];

float r[]=new float[z];

float pr[]=new float[z];

System.out.println("PLEASE ENTER::");

for(byte i=0;i<z;i++)

{

pr[i]=0;

System.out.print("Name of Item: ");

n[i]=in.readLine();

System.out.print("Rate of Item: ");

r[i]=Float.parseFloat(in.readLine());

System.out.print("Quantity of Items: ");

q[i]=Byte.parseByte(in.readLine());

pr[i]=r[i]*q[i];

}

double t=0;

for(byte i=0;i<z;i++)

t+=pr[i];

for(byte i=0;i<z;i++)

System.out.print("Item: "+n[i]+"\tQuantity: "+q[i]+"\tTotal Cost: "+pr[i]+"\n");

System.out.print("\nBill:"+t);

if(t>=100&&t<500)

System.out.print("\nGift::\nA Key Ring");

else if(t>=500&&t<1000)

System.out.print("\nGift::\nA Leather Purse");

else if(t>=1000)

System.out.print("\nGift::\nA Pocket Calculator");

}}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

/* For first 100 calls: Rs 100/-

* For Additional 50 calls: Rs 2/- per call

* For Calls more than 150: Rs 2.5/- per call

*/

import java.io.*;

class TelephoneBill

{

protected static void main()throws IOException

{

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

System.out.print("Enter the no. of calls: ");

int a=Integer.parseInt(in.readLine()),i=0;

float c=0;

while(0<1)

{

if(a<=100)

{

c=100;

break;

}

else if(150>=a&&a>100)

{

if(i==a)

break;

i++;

c+=2;

}

else

{

if(i==a)

break;

i++;

c+=2.5;

}

}

System.out.print("Amount to be paid: "+c);

}}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Private void ............................................................ {

int=Integer.parseInt(noofdaytf.getText);

int bill;

{

bill=noofday*150;

}

bill.setText("your cable bill is"+bill)

}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Shpooing bill, notepad, floor, piece of paper. You name it. You just need a pen and a bill

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in java to print amount of cable bill?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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 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 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 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.


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.


Write c program to print?

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