logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    kevinzhao183
    Jun 28, 2020
      ·  Edited: Jun 28, 2020

    Intro to Java 6/27 Homework

    in Java Question Bank

    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;

    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 + "%");

    }

    }


    0
    isaac.k.hsu
    Jul 03, 2020  ·  Edited: Jul 03, 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");

    }

    }

    0
    afefe2007
    Jul 08, 2020

    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"); } }

    0
    ivanyu521
    Jul 08, 2020

    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 + " % "); } }

    0
    nathanshimizu2016
    Jul 10, 2020

    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 + " %"); } }

    0
    5 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners