BJP4 Exercise 3.20: inputBirthday

bjp4 exercise 3.21: processname
bjp4 exercise 3.22: thenamegameexercise
bjp5 exercise 3.21: processname
bjp5 exercise 8.23 containsotherrectangle
practice-it answers
bjp4 exercise 3.19 printreverse
bjp4 exercise 3.3 printpowersofn
bjp4 exercise 3.11 distance

Write a method called inputBirthday that accepts a Scanner for the console as a parameter and prompts the user to enter a month, day, and year of birth, then prints the birthdate in a suitable format. Here is an example dialogue with the user:

I need to take this input like this-

On what day of the month were you born? 8 What is the name of the month in which you were born? May During what year were you born? 1981

output should be like this-

You were born on May 8, 1981. You're mighty old!

public static void main(String[] args) {

    inputBirthday();
}


  public static void inputBirthday() {
      Scanner abc = new Scanner(System.in);
      System.out.println("On what day of the month were you born? ");
      int inputDay = abc.nextInt();
      System.out.println("What is the name of the month in which you were born? ");
      String inputMonth = abc.next();
      System.out.println("During what year were you born? ");
      int inputYear = abc.nextInt();
      System.out.println("You were born on " + inputMonth + " " + inputDay + "," + " " + inputYear + "." + " You're mighty old!");
}

BJP4 Exercise 3.20: inputBirthday Errors, BJP4 Exercise 3.20: inputBirthday Errors. This is driving me batty and I am not sure what I'm doing wrong and could use some help. My program: import java.util . BJP4 Exercise 3.20 (inputBirthday) So far I'm enjoying the class and intend to complete it. However, I must say I'm quite disappointed with the BJP4 Exercise 3.20: inputBirthday problem.

public static void main(String[] args) {

    Scanner in = new Scanner(System.in);
    // either instantiate the enclosing class, or make inputBirthday static
    inputBirthday(in);
    }

  public static void inputBirthday(Scanner abc)
 {
    System.out.print("On what day of the month were you born? ");
    int inputDay = abc.nextInt();
    System.out.print("What is the name of the month in which you were born? ");
    String inputMonth = abc.next();
    System.out.print("During what year were you born? ");
    int inputYear = abc.nextInt();
    System.out.println("You were born on " + inputMonth + " " + inputDay + "," + " " + inputYear + "." + " You're mighty old!");
    }

finally it worked and code passed all tests

test results

inputBirthday.java, BJP4 Exercise 3.20: inputBirthday Write a method called inputBirthday that accepts a Scanner for the console as a parameter and prompts� BJP4 Exercise 3.20: inputBirthday Language/Type: Java input method basics parameters Scanner. Author: Marty Stepp (on 2016/09/08) Write a

public static void inputBirthday(Scanner input) {
     Scanner start = new Scanner(System.in);
    System.out.print("On what day of the month were you born? ");
    int day = input.nextInt();
    System.out.print("What is the name of the month in which you were born? ");
    String month = input.next();
    System.out.print("During what year were you born? ");
    int year = input.nextInt();
     System.out.println("You were born on " + month + " " + day + "," + " " + year + "." + " You're mighty old!");
}

inputBirthday - Solve a Problem, It seems like the exercise wants you to pass in a Scanner as an argument to your inputBirthday method, rather than creating (multiple) Scanners inside the� 2019 06 10 073936 1 15 Java BJP4 Chapter 2 BJP4 Self Check 230 nestedLoops 2019 from IS MISC at North Carolina State University BJP4 Chapter 3 BJP4 Exercise 3.20

Scanner as a parameter for the method? : javahelp, Write a method called inputBirthday that accepts a Scanner for the console as a parameter and prompts the user to enter a month, day, and� BJP4 Exercise 3.14: cylinderSurfaceArea Language/Type: Java Math method basics parameters return. Author: Marty Stepp (on 2016/09/08) Write a method

java - BJP4练习3.20:inputBirthday, View InputBirthday.java from CSC 110 at Mesa Community College. /* Victoria J. Heil * CSC110 Java Spring 2014 MCC * December 31, 2013 * Exercise 3.20, p. This question is linked to another question on this site: Beginner in Java - Using Parameters and Scanner The practice site in question creates the class and calls the method you write using the

Think your good at coding? try this!?, java - BJP4 Exercise 3.20: inputBirthday - Stack Overflow. stackoverflow.com. Top I believe the issue is that the requirements specifically state you are to write a � Building Java Programs 3rd Edition, Exercise Solutions Author: stepp Created Date: 4/22/2013 1:01:16 AM

Comments
  • Can not see the end of the text of the method - are you closing the string/method correctly?
  • Yeah last line is like this - System.out.println("You were born on " + a + " " + b + "," + " " + c + "." + " You're mighty old!");
  • Instead of showing image try to copy paste the code.
  • Maybe problem with the website, as you say works OK with intellij
  • I typed the whole code in text.
  • I have already done what you're telling me to do but still its showing the same error
  • @PratikSingh, if so, then please edit your question to show the actual current state of your code.
  • you can see modified code above please add import java.util.Scanner; in line 1
  • @PratikSingh, please see the edits I just made. The requirements specifically state a method inputBirthday accepting a parameter of a Scanner. You changed so the inputBirthday didn't take any parameters.
  • Thanks to all of you who had helped me solving this problem :)
  • This is the most simplest code you can type to get it correct!
  • Why are you initializing a new Scanner, that you're not using? And why are you using a parameter for the Scanner? Also.. this is basically identical to the answer given by Pratik Singh and the answer by KevinO. Can you explain how this answer adds value?