Question

I need this Program code made for Java please with the sample results.U06d1 Echo Using Methods Result U6D1_EchoUsingMethods - NetBeans IDE 8.1 File Edit View Navigate Source Refactor Run Debug Profile Team Tools Window Help Search (Cti+1) default config> | Files Start Page xU6D1 EchoUsingMethods.java x Source Padkages 12 author omora UGD1 Ed 13 Test Packages Lbraries 14 public class U6D1_EchoUsingMethods i Test Libraries 1 5 Output - U6D1_EchoUsingMethods (run) X ル run: 11ル Please enter a value: 9 Thanks! You entered: 9 BUILD SUCCESSFUL (total time: 3 seconds) Test Results ④ 22:31

Echo Input from the Console to the Screen Using Methods

Review the resources and instructions in the Discussion Prep Study before completing this discussion.

For this discussion, you practiced using Java methods to echo input from the console to the screen. Create a Java program that reads in any value entered at the console and then prints it out to the screen. The program must have at least three methods including the main() method.

Provide a screenshot of the result of your work.

Explain, briefly, how you completed this exercise, the algorithm you used (via pseudo code or other description tools), the major issues you faced, and how you solved them.

Reflect on your experience and what you learned.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class U6D1_EchoUsingMethods {

    public static int readInteger() {
        Scanner in = new Scanner(System.in);
        System.out.print("Please enter a value: ");
        return in.nextInt();
    }

    public static void displayInteger(int num) {
        System.out.println("Thanks! You entered: " + num);
    }

    public static void main(String[] args) {
        displayInteger(readInteger());
    }

}

Add a comment
Know the answer?
Add Answer to:
I need this Program code made for Java please with the sample results. Echo Input from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Echo Input from the Console to the Screen Review the resources and instructions in the Discussion...

    Echo Input from the Console to the Screen Review the resources and instructions in the Discussion Prep Study before completing this discussion. To prepare for this discussion, you practiced echoing the value read from the console to the screen. Create a Java program that reads in any value entered at the console and then prints it out to the screen. Provide a screenshot of your result of your work. Your screenshot should look like the example in the "Echo Input...

  • I need this in JAVA please: Design and implement a program (name it MinMaxAvg) that defines...

    I need this in JAVA please: Design and implement a program (name it MinMaxAvg) that defines three methods as follows: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. In the main method, test all three methods with different input value read...

  • PSEUDOCODE AND JAVA SOURCE CODE PLEASE: Program 1 (60 pts): Find the Rabbit! For this assignment,...

    PSEUDOCODE AND JAVA SOURCE CODE PLEASE: Program 1 (60 pts): Find the Rabbit! For this assignment, you will write a program that asks the user to find a rabbit in one of 10 holes (0-9). The holes and guesses are visualized on the screen (as shown below), but as the user guesses, you should not show where the rabbit is hidden. The rabbit is assigned a random hole each time the program is run. You must write and use at...

  • In Java code Exercise #1: (Java) Design and implement a program (name it MinMaxAvg) that defines...

    In Java code Exercise #1: (Java) Design and implement a program (name it MinMaxAvg) that defines three methods as follows: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. In the main method, test all three methods with different input value read...

  • Can anyone debug this for me please? Java code to copy package debugmeone; import java.io.File; import...

    Can anyone debug this for me please? Java code to copy package debugmeone; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ReadTextFile { private Scanner input; // Ignore the hint given by NetBeans public void openFile() { try { input = new Scanner( new File("accountrecords.txt")); } catch(Exception e) { System.out.println("Something bad just happened here."); System.exit(707); } catch( FileNotFoundException fnfe) { System.out.println("Error - File Not Found: accountrecords.txt"); System.exit(100); } } } ITCS-2590 Debugging Execse Chapter 11 - NetBeans IDE 8.2 File...

  • CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods...

    CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods Create a folder called Unit03 and put all your source files in this folder. Write a program named Unit03Prog1.java. This program will contain a main() method and a method called printChars() that has the following header: public static void printChars(char c1, char c2) The printChars() method will print out on the console all the characters between c1 and c2 inclusive. It will print 10...

  • Need help with java programming. Here is what I need to do: Write a Java program...

    Need help with java programming. Here is what I need to do: Write a Java program that could help test programs that use text files. Your program will copy an input file to standard output, but whenever it sees a “$integer”, will replace that variable by a corresponding value in a 2ndfile, which will be called the “variable value file”. The requirements for the assignment: 1.     The input and variable value file are both text files that will be specified in...

  • Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design...

    Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design and code a Java console application that reads in seven integer values and prints out the number of occurrences of each value. The application uses the Java single dimension array construct to implement its functionality. Your program output should look like the sample output provided in the "Count Occurrences in Seven Integers Using Java Single Dimension Arrays Instructions" course file resource. Full instructions for...

  • This Java program reads an integer from a keyboard and prints it out with other comments....

    This Java program reads an integer from a keyboard and prints it out with other comments. Modify the comments at the top of the program to reflect your personal information. Submit Assignment1.java for Assignment #1 using Gradescope->Assignemnt1 on canvas.asu.edu site. You will see that the program has a problem with our submission. Your program is tested with 4 testcases (4 sets of input and output files). In order to pass all test cases, your program needs to produce the same...

  • Please show that the code is working at the end. Your program should read from the standard input...

    Please show that the code is working at the end. Your program should read from the standard input a sequence of integer values, with each value separated by a space. Your task is to: Build a binary search tree using these values in the order they are entered. Print 3 traversals: pre-, in-, and post-order. Allow the user to insert/delete a value. Once a new tree is generated, print it in-order. Find predecessor of a given value. The predecessor is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT