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
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("*");
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started