Page details
First discovered on:
12:12pm, 12/08/13

All tags for this page:
0%
0 folks

Program to read from user and then stop | Developer Question - Msn4free.com

msn4free.com/developersq/program-to-read-from-us... - Details

lizaa_us: Program to read from user and then stop I am trying to write a program for a homework that reads fruit name, price and kilograms from the user then prints out each fruit entered with its price, kilograms and total price. What I cannot do is...

to tags:                   ...

Save this page to your bookmarks.

Tagged and described by the following users:

lizaa_us saved this page on 12/08/2013 12:12pm

Program to read from user and then stop I am trying to write a program for a homework that reads fruit name, price and kilograms from the user then prints out each fruit entered with its price, kilograms and total price. What I cannot do is to make it read until the user inputs "stop" then it stops and gives the above calculation. I've done the following so far: import java.util.Scanner; // importing class scanner public class Q2 { // class declaration public static void main(String[] args) { Scanner input = new Scanner(System.in); int Price; int Kilograms; int sum; int fruit; System.out.print("Enter Price here ");//prompt Price = input.nextInt();// System.out.print("Enter Kilograms here ");//prompt Kilograms = input.nextInt(); sum = Price * Kilograms; System.out.printf("Total price is %dn", sum);

Tags: program  to  read  from  user  and  then  stop  |  developer  ...

This URL was also folkd by:

by