1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Delicious77 [7]
3 years ago
9

As a twist on the Hello World exercise, you are going to be the end user of the Hello class. This class is designed to greet the

user in a variety of world languages. For this task, complete the following:
Use the Scanner class to ask the user for their name.
Create a Hello object by passing the name to the constructor.
Call at least 3 methods from the Hello class to print the greeting in 3 different languages.
Remember to write your code in the HelloTester class, but make sure you take a look at the Hello class so that you know the names of the methods you need to use.

Computers and Technology
1 answer:
Flura [38]3 years ago
4 0

Answer:

Here is the Hello class:

public class Hello { //class name

     private String name; //to store the name

     

      public Hello (String names) //parameterized constructor

      { name = names;  }  

     

      public void English() { //method to greet user in english

           System.out.print("Hello "); //displays Hello on output screen

           System.out.print(name); //displays user name

           System.out.println("!");  }  //displays exclamation mark symbol

           

           public void Spanish(){ //method to greet user in spanish

               System.out.print("Hola "); //displays Hello on output screen

               System.out.print(name); //displays user name

               System.out.println("!"); } //displays exclamation mark symbol

           

         public void French() { //method to greet user in french

              System.out.print("Bonjour "); //displays Hello on output screen

              System.out.print(name);  //displays user name

              System.out.println("!");  } } //displays exclamation mark symbol

           

Explanation:

Here is the HelloTester class:

import java.util.Scanner; //to accept input from user

public class HelloTester { //class name

 public static void main (String[]args)  { //start of main method

String name; //to store the name of user

Scanner input = new Scanner(System.in);  //creates Scanner class object

System.out.println("Enter name?" );  //prompts user to enter name

 name = input.nextLine(); //scans and reads the name from user

 Hello hello = new Hello(name); //creates Hello class object and calls constructor by passing name

hello.English(); //calls English method using object hello to greet in english

hello.Spanish(); //calls Spanish method using object hello to greet in spanish

hello.French(); } }  //calls French method using object hello to greet in french

The output of the program is:

Enter name?                                                                                                                    user                                                                                                                           Hello user!                                                                                                                    Hola user!                                                                                                                    Bonjour user!  

The screenshot of the program along with its output is attached.

You might be interested in
_is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special spli
adell [148]

Splicing is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special splicing device.

Which is an electrical conductor?

An electrical current flows through a conductor because it provides little to no resistance to the movement of electrons. Typically, good electrical conductors include metals, metal alloys, electrolytes, and even some nonmetals like graphite and liquids like water.

What is the purpose of a splice?

It can be used to package and stop the fraying of rope ends as well as as a foundation for more complex knots like the surgeon's knot and the square knot. Wrap the rope end around the standing part to form a loop, then bring the end of the loop through and draw the rope taut to tie an overhand knot.

Is it safe to splice electrical wire?

The splice may overheat and pose a fire risk when the current passes through it. Always utilize a junction box to store all the spliced wires while splicing wires. Any sparks produced during a short circuit are contained in junction boxes, which offer protection from electrocution and fires.

Learn more about electrical conductors: brainly.com/question/28209810

#SPJ4

4 0
1 year ago
How does computer network work in a paragraph
Maksim231197 [3]

You go in to the networks crosh/Linux and you insert the info you want in code

7 0
3 years ago
When you sign in to your Microsoft account with another Windows device, your settings will appear very differently than they do
djyliett [7]

Answer:

True

Explain:

All of the setting are device setting that dont follow your account.

3 0
2 years ago
Complete each sentence to describe different elements of an Excel worksheet.
barxatty [35]

Answer:

Answer is - cell, - column, - string value

Explanation:

  • <em>Cell - this is often referred to as the intersection of a single row and column.  </em>
  • <em>Column - this is a group of cells which are represented vertically.  </em>
  • <em>String - these are values that are inside the cell which are represented through texts or group of letters including acceptable symbols and characters.</em>
7 0
2 years ago
Read 2 more answers
2.17.5 coders answers
BlackZzzverrR [31]

Answer:

start();

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

}

}

function start(){

}

Q. 5.1.3: Move to Wall

Ans:

function start(){

while(frontIsClear()){

move();

}

}

I apologize if its incorrect

5 0
2 years ago
Other questions:
  • 2. Write the binary representation of number 1037.379 in IEEE 754 standard in single precision. Express the result in binary, oc
    7·1 answer
  • In Paint, which of the following are ways to use a picture that you have saved on your computer? (Select all that apply.)
    8·1 answer
  • what is the gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    7·2 answers
  • A(n) _____ is a computer program that can damage files and programs on your computer.
    6·2 answers
  • Write bash script which takes array as an input of size 10 bind its even indexes to accept even values and odd indexes to accept
    5·1 answer
  • Fill in the blank with the correct response.
    6·1 answer
  • What is the difference between KE an PE
    8·1 answer
  • Write a paragraph explaining why you think its important to use ethics in computers
    9·1 answer
  • Describe four traditional tehniques for collecting information during analysis.
    11·1 answer
  • Help me with this two questions please
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!