I'm working a project in my Java online course, and I've been forced to construct a program to give the desired output, without being given any clues to assist me. So the error is most definitely on my part, and not the machine's. Though extensive googling has led me to a dead end.
This is the sample output given to me by edX.
And here is the code I've devised so far, with the little knowledge I have.
import java.util.Scanner;
public class planner {
public static void main(String[] args) {
System.out.println("Planner initialized.");
System.out.println("Reading settings..");
System.out.println("Assessing environment..");
System.out.println("Gathering tools..");
System.out.println("****************************************");
System.out.println("");
intro();
}
public static void intro() {
System.out.println("Welcome to the vacation planner.");
System.out.println("What is your name?");
Scanner fn = new Scanner(System.in);
Scanner ln = new Scanner(System.in);
System.out.println("Welcome, " + fn + ln + ". Where are you traveling to?");
Scanner loc1 = new Scanner(System.in);
Scanner loc2 = new Scanner(System.in);
System.out.println("Excellent. " + loc1 + loc2 + " it is.");
System.out.println("*****************************************");
System.out.println("");
calc();
}
public static void calc() {
System.out.println("How many days are you planning to spend away?");
Scanner x = new Scanner(System.in);
System.out.println("How much money, in U.S. dollars, are you planning to spend?");
Scanner m = new Scanner(System.in);
System.out.println("What is the three-letter currency symbol for your destination?(Google may be required)");
Scanner i = new Scanner(System.in);
System.out.println("How many " + i + " are there in USD? (Google may be required)");
Scanner o = new Scanner(System.in);
System.out.println("");
float t = x.nextFloat();
float r = m.nextFloat();
float k = o.nextFloat();
//To calculate the amount of hours
float n = t * 24;
//To calculate the amount of minutes
float u = (t * 24) * 60;
//To calculate daily budget
float y = t / r;
// To calculate currency exchange
float e = k * r;
//To calculate budget in alt currency
float q = t / e;
System.out.println("If you are travelling for " + t + " days, that is the same as " + n + " hours, or " + u + " minutes.");
System.out.println("If you are going to spend " + r + " U.S. dollars per day, you can spend" + y + " dollars per day.");
System.out.println("Your total budget in " + i + "is " + e + i + ", which, per day, is " + q + i);
System.out.println("****************************************");
System.out.println("");
}
}
And the output I've been given:
/home/foo/jdk-9.0.4/bin/java -javaagent:/opt/intellij-idea-community/lib/idea_rt.jar=37671:/opt/intellij-idea-community/bin -Dfile.encoding=UTF-8 -classpath /home/samuel/IdeaProjects/Module-test/out/production/Module-test planner
Planner initialized.
Reading settings..
Assessing environment..
Gathering tools..
****************************************
Welcome to the vacation planner.
What is your name?
Welcome, java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E]java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E]. Where are you traveling to?
Excellent. java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E]java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E] it is.
*****************************************
How many days are you planning to spend away?
How much money, in U.S. dollars, are you planning to spend?
What is the three-letter currency symbol for your destination?(Google may be required)
How many java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E] are there in USD? (Google may be required)
And I think it's the [need input=false]
declaration that it gives me that's telling me the problem, but I don't understand what's wrong. Could I have some assistance?