For your homework, complete the following problem:
Make sure you use a Scanner to input the number of movie rentals and the number of referrals. Comment your solution to this post.
5 comments
0
leosong23
Jun 29, 2020
import java.util.Scanner;
publicclass Discount_Calculator {
public Discount_Calculator() {
// TODO Auto-generated constructor stub
}
publicstaticvoid main(String[] args) {
// TODO Auto-generated method stub
Scanner in1 = new Scanner (System.in);
System.out.print("How many movies did the customer rent: ");
intrented_movies = in1.nextInt();
System.out.println("");
Scanner in2 = new Scanner (System.in);
System.out.print("How many customers did they refer: ");
intcustomers_refered = in2.nextInt();
int discount = Math.min(customers_refered + rented_movies, 75);
System.out.println("Discount is " + discount + "%");
}
}
isaac.k.hsu
Jul 3, 2020 · Edited: Jul 3, 2020
import java.util.Scanner;
public class Discount {
public static void main(String[] args) {
Scanner a = new Scanner (System.in);
System.out.println("How many movies were rented?");
int rented = a.nextInt();
Scanner b = new Scanner (System.in);
System.out.println("How many members were refered?");
int referred = b.nextInt();
int discount = Math.min(rented+ referred, 75);
System.out.print("The total discount is " + discount + " percent");
}
}
afefe2007
Jul 8, 2020
import java.util.Scanner;class Main {publicstaticvoid main(String[] args) { System.out.println("How many movies did you rent?"); Scanner sc = new Scanner(System.in);float rented = sc.nextFloat(); System.out.println("How many members were refered?");float referred = sc.nextFloat();float discount = Math.min(rented+ referred, 75); System.out.print("The total discount is " + discount + " percent"); }}
ivanyu521
Jul 8, 2020
import java.util.Scanner;class Main {publicstaticvoid main(String[] args) {
System.out.println("How many movies did we rent?");
System.out.println("How many members did we refer?");
int referred = sc.nextFloat();
int discount = Math.min(rented+ referred, 75);
System.out.print("The total discount is " + discount + " % "); }}
nathanshimizu2016
Jul 10, 2020
import java.util.Scanner;class Main {publicstaticvoid main(String[] args) { System.out.println("How many movies were rented?"); Scanner movies = new Scanner(System.in);int movie = movies.nextInt(); System.out.println("How many members have you refered?"); Scanner members = new Scanner(System.in);int member = members.nextInt();int discount = Math.min(movie+member, 75); System.out.println("Your discount is " + discount + " %");}}
import java.util.Scanner;
public class Discount_Calculator {
public Discount_Calculator() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in1 = new Scanner (System.in);
System.out.print("How many movies did the customer rent: ");
int rented_movies = in1.nextInt();
System.out.println("");
Scanner in2 = new Scanner (System.in);
System.out.print("How many customers did they refer: ");
int customers_refered = in2.nextInt();
int discount = Math.min(customers_refered + rented_movies, 75);
System.out.println("Discount is " + discount + "%");
}
}
import java.util.Scanner;
public class Discount {
public static void main(String[] args) {
Scanner a = new Scanner (System.in);
System.out.println("How many movies were rented?");
int rented = a.nextInt();
Scanner b = new Scanner (System.in);
System.out.println("How many members were refered?");
int referred = b.nextInt();
int discount = Math.min(rented+ referred, 75);
System.out.print("The total discount is " + discount + " percent");
}
}
import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println("How many movies did you rent?"); Scanner sc = new Scanner(System.in); float rented = sc.nextFloat(); System.out.println("How many members were refered?"); float referred = sc.nextFloat(); float discount = Math.min(rented+ referred, 75); System.out.print("The total discount is " + discount + " percent"); } }
import java.util.Scanner; class Main { public static void main(String[] args) {
System.out.println("How many movies did we rent?");
Scanner sc = new Scanner(System.in);
int rented = sc.nextFloat();
System.out.println("How many members did we refer?");
int referred = sc.nextFloat();
int discount = Math.min(rented+ referred, 75);
System.out.print("The total discount is " + discount + " % "); } }
import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println("How many movies were rented?"); Scanner movies = new Scanner(System.in); int movie = movies.nextInt(); System.out.println("How many members have you refered?"); Scanner members = new Scanner(System.in); int member = members.nextInt(); int discount = Math.min(movie+member, 75); System.out.println("Your discount is " + discount + " %"); } }