Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I cannot figure out what I am doing wrong with the parameters and variable int m

ID: 3914028 • Letter: I

Question

I cannot figure out what I am doing wrong with the parameters and variable int months. I am getting an error on the line findTotal(int months); which is line 11. This is what I currently have.

import java.util.*; //for Scanner

public class MetaviewProject {

  

  

   public static void main(String args[])

   {

     

      drawStars();

      Months();

      findTotal(int months);

      drawStars1();

       }

      

      public static void drawStars() {

       for (int i=1; i<=21; i++) {

           System.out.print("*");

          

       }

       System.out.print("MetaCorp Streaming Service");

       for (int i=1; i<=21; i++) {

           System.out.print("*");

       }

       System.out.println("");

   }

   

      public static void Months() {

    Scanner console = new Scanner(System.in);

          System.out.println("Enter number of months on subscription:");

int months = console.nextInt();

      }

      public static void findTotal(int months) {

          String myInput;

   int total = 0;

   Scanner console = new Scanner(System.in);

  

   //Hulu

   System.out.print("Do you want Hulu ($8/month) Yes/No ? ");

   myInput = console.nextLine();

   if(myInput.equalsIgnoreCase("yes"))

   total = total + 8; //new total per month after Hulu Question

  

   //Netflix

   System.out.print("Do you want Netflix ($10/month Yes/No ? ");

   myInput = console.nextLine();

   if(myInput.equalsIgnoreCase("yes"))

   total = total + 10; //new total per month after Netflix Question

  

//Prime

System.out.print("Do you want Prime ($7/month) Yes/No ? ");

myInput = console.nextLine();

if(myInput.equalsIgnoreCase("yes"))

total = total + 7; //new total per month after Prime Question

System.out.println("Your total is $" + (months *total));

      }

     

public static void drawStars1() {

       for (int i=1; i<=68; i++) {

           System.out.print("*");

       }

}

}

Explanation / Answer

import java.util.Scanner;

public class Main {

public static void main(String args[])

{

drawStars();

Months();

drawStars1();

}

public static void drawStars() {

for (int i=1; i<=21; i++) {

System.out.print("*");

}

System.out.print("MetaCorp Streaming Service");

for (int i=1; i<=21; i++) {

System.out.print("*");

}

System.out.println("");

}

public static void Months() {

Scanner console = new Scanner(System.in);

System.out.println("Enter number of months on subscription:");

int months = console.nextInt();

findTotal(months); // it has to be called here inside this method

}

public static void findTotal(int months) {

String myInput;

int total = 0;

Scanner console = new Scanner(System.in);

//Hulu

System.out.print("Do you want Hulu ($8/month) Yes/No ? ");

myInput = console.nextLine();

if(myInput.equalsIgnoreCase("yes"))

total = total + 8; //new total per month after Hulu Question

//Netflix

System.out.print("Do you want Netflix ($10/month Yes/No ? ");

myInput = console.nextLine();

if(myInput.equalsIgnoreCase("yes"))

total = total + 10; //new total per month after Netflix Question

//Prime

System.out.print("Do you want Prime ($7/month) Yes/No ? ");

myInput = console.nextLine();

if(myInput.equalsIgnoreCase("yes"))

total = total + 7; //new total per month after Prime Question

System.out.println("Your total is $" + (months *total));

}

public static void drawStars1() {

for (int i=1; i<=68; i++) {

System.out.print("*");

}

}

}

/*SAMPLE OUTPUT

*******MetaCorp Streaming Service*******

Enter number of months on subscription:

4

Do you want Hulu ($8/month) Yes/No ? Yes

Do you want Netflix ($10/month Yes/No ? No

Do you want Prime ($7/month) Yes/No ? Yes

Your total is $60

****************************************

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote