import java.io.*;
//import javax.swing.*;
class Candy {
public static void main (String[] args) throws IOException {
BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
int num1, num2, sum; // declares three integers
double dollars; // declares a number that can have decimals
System.out.print ("How many candy bars do you want : ");
System.out.flush();
// read a line, and then converts it to an integer
num1 = Integer.parseInt( stdin.readLine());
System.out.print ("How many suckers you do want : ");
System.out.flush();
num2 = Integer.parseInt( stdin.readLine());
sum = num1 + num2; // Adds the two numbers;
dollars = (double) sum * .75;
System.out.println("You owe : $" + dollars);
//JOptionPane.showMessageDialog(null,"You owe : $" + dollars);
} // method main
}
Tuesday, 23 January 2018
Related Posts:
Drawing in java package geometry.drawing;public class Point {int x_coord;int y_coord;p… Read More
drawing of circle in java Drawing of circle in java package geometry.drawing;public class Cir… Read More
Java Interface Example in java/*Java Interface example.This Java Interface example describes how int… Read More
Calculator in java package calculation.twovar;public class DIFFERENCE{ &… Read More
0 comments: