The following program is used in a bookstore to determine how many discount coupons a customer gets. Complete the table that appears after the program.
import javax.swing.JOptionPane;
public class Checkpoint
{
public static void main(String[] args)
{
int books, coupons;
String input;
input = JOptionPane.showInputDialog(“How many books ” +“are being purchased? ”);
books = Integer.parseInt(input);
if (books < 1)
coupons = 0;
else if (books < 3)
coupons = 1;
else if (books < 5)
coupons = 2;
else
coupons = 3;
JOptionPane.showMessageDialog(null, “The number of coupons to give is ” + coupons);
System.exit(0);
}
}
If the customer purchases this many books … | this many coupons are given. |
1 | _____ |
2 | _____ |
3 | _____ |
4 | _____ |
5 | _____ |
10 | _____ |
Trending nowThis is a popular solution!
Chapter 3 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Starting Out with C++: Early Objects (9th Edition)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Degarmo's Materials And Processes In Manufacturing
SURVEY OF OPERATING SYSTEMS
Mechanics of Materials (10th Edition)
Electric Circuits. (11th Edition)