Starting Out with Java: Early Objects (6th Edition)
Starting Out with Java: Early Objects (6th Edition)
6th Edition
ISBN: 9780134462011
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 4.5, Problem 4.15CP

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 _____
Blurred answer
Students have asked these similar questions
I need to resolve the following....You are trying to convince your boss that your company needs to invest in a license for MS-Project (project management software from Microsoft) before beginning a systems project. What arguments would you give her?
What are the four types of feasibility? what is the issues addressed by each feasibility component.
I would like to get ab example of a situation where Agile Methods might be preferable versus the traditional SDLC? What are the characteristics of this situation that give Agile Methods an advantage?

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY