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
Please help me and solution in c language​
salantis [7]
Ummmm the solution is ummm brb
3 0
3 years ago
Ben uses a table that has few columns. He knows about a particular value in the first column and wants to find the corresponding
igor_vitrenko [27]
I'd suggest he uses LOOKUP Function.

You can use the LOOKUP function when you need to look in a single column or row and find a value from the same position in a corresponding column or row. We have a much improved VLOOKUP that can also be used to search one row or column or multiple rows and columns.



4 0
3 years ago
Read 2 more answers
Where would you go to add fractions to a document in adobe indesign
prisoha [69]

Just select the fraction text and choose Open Type > Fractions from the Character panel menu.

5 0
3 years ago
Generally, websites ending in .edu, .gov, and .org are less likely to be biased, or to show preference toward a certain financia
svetlana [45]

Answer:

True

Explanation:

Domain extensions always appear at the end of a website's address.

It's a means to categorise websites.

.edu domains are used for educational purposes

.gov are restricted to by government entities

.org is largely used by nonprofit websites.

While

.net is derived from the word network, indicating it was originally intended for organizations involved in networking technologies, such as Internet service providers and other infrastructure companies

.biz is intended for registration of domains to be used by businesses

The right domain extension adds credibility and memorability to your website by aligning it with a specific brand purpose.

8 0
3 years ago
How many panes can Pablo view in a spreadsheet if he chooses the split worksheet option?
ddd [48]
Pablo can be a minimum of two pains and a maximum of four panes in a split screen worksheet.
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of these is NOT an advantage of the impact of computer careers.
    9·1 answer
  • Uma organização pode ser entendida como uma instituição ou associação com objetivos predefinidos. Qual é um dos primeiros concei
    10·1 answer
  • Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
    8·1 answer
  • Stress results from _______. A. Outside stimulus b. Internal stimulus c. Outside calm d. Internal calm
    12·2 answers
  • Tony is in charge of all presentations for a Fortune 500 pharmaceutical company. In addition to creating powerful and persuasive
    9·1 answer
  • EIPP:________.
    9·2 answers
  • In python:
    14·1 answer
  • Is the following statement true or false?
    12·1 answer
  • You are hired by a game design company and one of their most popular games is The Journey. The game has a ton of quests, and for
    12·2 answers
  • Write A Code In Python
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!