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]
4 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]4 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
When entering numbers that start with a zero, apply the _____ number format.
yuradex [85]

Answer:

The Answer is gonna be D. Zero decimal

3 0
3 years ago
Application partitioning gives developers the opportunity to write application code that can later be placed on either a client
Hunter-Best [27]

Answer:

True

Explanation:

Application partitioning is defined as the process by which pieces of application codes are assigned to servers or clients. it provides a description of the processes involved when developing applications that requires distribution of the application logic among more than one computer in a network. It provides developers the opportunity to write application codes capable of being placed on a later time on a server or client workstation. The decision is dependent on the location capable of bringing the best performance.

8 0
3 years ago
Write a C++ program that would take 10 integers and outputs mean, median, and range. Create at least three functions: one for so
Ksenya-84 [330]
Yes c is correct because yeah i said so
5 0
3 years ago
Select the correct answer.
melomori [17]

A. a next generation car

8 0
3 years ago
Physical safeguards, also called logical safeguards, and are applied in the hardware and software of information systems.
Nitella [24]

Answer:

False

Explanation:

They are not applied in the hardware and software of information systems.

3 0
3 years ago
Other questions:
  • The network board in a workstation is currently configured as follows:- network speed = auto- duplexing = autoThe workstation is
    13·2 answers
  • What are the advantages and disadvantages of using thermoset plastics
    14·1 answer
  • 2. What's the keyboard command that will allow you to "copy" text?
    8·2 answers
  • What does CRM stand for?
    10·1 answer
  • In the circuit shown in the figure above, what will happen when switches S1 and S3 are both closed? 
    8·1 answer
  • The market is in <br> until the price of goods reflects equal supply and demand.
    10·1 answer
  • What is this app for ?
    10·2 answers
  • Explain basic anatomy of computers.
    13·2 answers
  • What is the relationship between hardware and software technology tools?
    7·2 answers
  • What are two reasons why a switch port would have a status of errdisable? (choose two. )
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!