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 | _____ |
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with Java: Early Objects (6th Edition)
Additional Engineering Textbook Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Concepts Of Programming Languages
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Modern Database Management (12th Edition)
Starting Out with Python (4th Edition)
- answer itarrow_forward//Assignment 06 */public static void main[](String[] args) { String pass= "ICS 111"; System.out.printIn(valPassword(pass));} /* public static boolean valPassword(String password){ if(password.length() > 6) { if(checkPass(password) { return true; } else { return false; } }else System.out.print("Too small"); return false;} public static boolean checkPass (String password){ boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c; for(int i = 0; i < password.length(); i++) { c = password.charAt(1); if(Character.isDigit(c)); { hasNum = true; } else if(Character.isUpperCase(c)) { hasCap = true; } else if(Character.isLowerCase(c)) { hasLow = true; } } return true; { return false; } }arrow_forwardPLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…arrow_forward
- // DebugFive4.java // Outputs highest of four numbers import java.util.*; public class DebugFive4 { publicstaticvoidmain (Stringargs[]) { Scanner input =newScanner(System.in); int one, two, three, four; String str, output; System.out.println("Enter an integer"); str = input.next(); one = Integer.parseInt(str); System.out.println("Enter an integer"); str = input.next(); two = Integer.parseInt(str); System.out.println("Enter an integer"); str = input.next(); three = Integer.parseInt(str); System.out.println("Enter an integer"); str = input.next(); four = Integer.parseInt(str); if(one > two > one > three > one > four) output = "Highest is " + four; else if(two > one && two > three !! two > four) output = "Highest is " + three; else if(three > one && three > two && three > four) output = "Highest is " + three; else output = "Highest is " + four; System.out.println(output); } }arrow_forwardclass Output{public static void main(String args[]){Integer i = new Integer(557);float x = i.floatValue();System.out.print(x);}} What will the given code prints on the output screen.arrow_forwardclass Lab4Q1P3 { public static void main(String args[]) { int max = 10;while (max < 10) {System.out.println("count down: " + max);max--;}}} Do you know what is wrong with the program? I know that there is error on the 7th line but I don't know what to fix.arrow_forward
- public class Side Plot { * public static String PLOT_CHAR = "*"; public static void main(String[] args) { plotxSquared (-6,6); * plotNegXSquaredPlus20 (-5,5); plotAbsXplus1 (-4,4); plotSinWave (-9,9); public static void plotXSquared (int minX, int maxx) { System.out.println("Sideways Plot"); System.out.println("y = x*x where + minX + "= minX; row--) { for (int col = 0; col row * row; col++) { System.out.print (PLOT_CHAR); if (row== 0){ } System.out.print(" "); } for(int i = 0; i <= maxx* maxX; i++) { System.out.print("-"); } System.out.println(); Sideways PHOT y = x*x where -6<=x<=6 Sideways Plot y = x*x where -6<=x<=6 How do I fix my code to get a plot like 3rd picture?arrow_forwardThis is the code that needs to be corrected: // This application gets a user's name and displays a greeting import java.util.Scanner; public class DebugThree3 { public static void main(String args[]) { String name; name = getName(); displayGreeting(name); } public static String getName(name) { String name; Scanner input = new Scanner(System.in); System.out.print("Enter name "); name = input.nexlLine(); return name; } public static displayGreeting(String name) { System.outprintln("Hello, " + name + "!"); } }arrow_forward1- public class MathF{ public static void main(String[] args) 3 {char[] grade%=new char[4]; grade[1]='B'; 5 grade[3]='C'; 6 Integer d1= new Integer(6); Integer d2= new Integer(10); 8 if(d1!= d2){ System.out.println("grades do not match "); System.out.println("Result: "+Math.sqrt(d1+d2)); 11 } 12 else 13- { System.out.println("Marks are same"); 14 for (int i-0;i<4;i++) 15 System.out.println(grade[i]); } 16 }} Answer:arrow_forward
- Question public class MyProgram { if (h 18) { public static void main(String[] args) { int h=10, t-22; System.out.print ("Good "); } } else } } What is the output displayed by the following lines of code?" System.out.print ("Morning"); t = t + 2; if (t > 30) System.out.println(" Every one!"); System.out.println("The Your answer system.out.print("Evening"); t = t + 5; temperature is " System.out.println(" Brink water?"); Degree.");arrow_forward// This program assigns values to two variables // and performs mathematical operations with them public class DebugFour1 { public static void main(String args[]) { int x = 5; int y = 8; int z = 19; System.out.println("adding " + x + y); System.out.println("subtracting " + y - z); System.out.println("dividing " + z / x); System.out.println("multiplying " + x / z); } }arrow_forwardpublic class Course{String name;String dept;int number;public Course (String n, String d, int n){name = n;dept = d;number = n;}public String toString(){return "Course " + name + " in " + dept + " #: " + number;}public static void main (String [] args){Scanner in = new Scanner(System.in);add 10 lines using the scanner and saving them as strings The input for each line will be entered a String, a space, another String, and an int. Parse the input string into those three items and make an instance of Course. Add the new Course instance to a generic ArrayList of Course. print out each Course in the ArrayList.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education