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

Starting point: ================================================================

ID: 3616113 • Letter: S

Question

Starting point:

===================================================================

import java.util.Scanner;

public classDiscussionOne{

public static voidmain(String[] args){

//Added by MichaelJenkins

//Constructor for all non-staticmethods in this class file.

//dissOne can be called for anyother methods added to this class.

//No need to add anotherconstructor.

//Page 139 discussesconstructors

DiscussionOne dissOne= new DiscussionOne();

//Example call to method displayinga personal greeting

dissOne.displayWelcomeMessage();

//End of code by MichaelJenkins

}

/**

* Added by MichaelJenkins

* This method asks user for input(name)

* Then displays a personalizedwelcome

* message to theuser.

*/

public voiddisplayWelcomeMessage(){

//Scanner class used to get inputfrom user.

//Pages 86-89

Scanner userInput =newScanner(System.in);

//print and println are used to sendoutput to the screen.

//Pages 37-42

System.out.print("Please type your full name:");

String name =userInput.nextLine();

System.out.print("Welcome, " +name);

System.out.println(", to the firstDiscussion Question.");

}

}

Explanation / Answer

please rate - thanks you were very vague in your question and most of us don't have the book this uses methods, arguments, variables hope it gets you started import java.util.Scanner; public class DiscussionOne { public static void main(String[] args) { //Added by Michael Jenkins //Constructor for all non-static methods in this class file. //dissOne can be called for any other methods added to thisclass. //No need to add another constructor. //Page 139 discusses constructors DiscussionOne dissOne = new DiscussionOne(); //Example call to method displaying a personal greeting dissOne.displayWelcomeMessage(); //End of code by Michael Jenkins int n; Scanner in=new Scanner(System.in); System.out.println(" I will now generate a hailstonesequence"); System.out.print("Enter a starting number: "); n=in.nextInt(); Hailstone(n); } /** * Added by Michael Jenkins * This method asks user for input (name) * Then displays a personalized welcome * message to the user. */ public static void Hailstone(int n) {while(n!=1)    {if(n%2==0)        n/=2;    else        n=n*3+1;    System.out.println(n);    } }    public void displayWelcomeMessage() { //Scanner class used to get input from user. //Pages 86-89 Scanner userInput = new Scanner(System.in); //print and println are used to send output to the screen. //Pages 37-42 System.out.print("Please type your full name: "); String name = userInput.nextLine(); System.out.print("Welcome, " + name); System.out.println(", to the first Discussion Question."); } }

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