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
In the event of a network attack or intrusion, a _____ lists the tasks that must be performed by the organization to restore dam
dexar [7]

Answer:

The answer is "Recovery Plan for Disasters".

Explanation:

In the given statement, some of the information is missing, which can be described as follows:

A) systems engineering plan

B) security compliance plan

C) risk assessment plan

D) Recovery Plan for Disasters

It is a set of guidelines for the execution of a recovery process, it provides the restoration and safety to the system for the organization in the event of a disaster. It defined as "a detailed summary of the appropriate acts to be carried out before, during and after a disaster", and incorrect choices were explained as follows:

  • In option A, It is used to design and analyze complex systems.
  • In option B, It provides frameworks for the corporate evaluation process.
  • In option C, It is used to identify the problems.
6 0
3 years ago
Which activity uses a feature of a word processor?
Anvisha [2.4K]
The activity that uses a feature of a word processor is the last given answer. Recreating the same document multiple times to print multiple copies. Although some word processors have all the features stated above now a days. Word processors are helpful in composing, editing and printing text documents.
3 0
3 years ago
Read 2 more answers
Which option in a Task element within Outlook indicates that the task is scheduled and will be completed on a later
joja [24]
I think it’s in progress
5 0
2 years ago
Read 2 more answers
Why do the digital animations begin as sketches drawn by hand?
svet-max [94.6K]
To get a sense as to what they are doing. They have to draw frame after frame after frame. Go back and fix it up. It's easier to draw on paper than use a mouse.
8 0
3 years ago
Consider the following code segment. int j = 10; int k = 8; j += 2; k += j; System.out.print(j); System.out.print(" "); System.o
lubasha [3.4K]

Answer:

Following are the output of the given code:

Output:

12 20

Explanation:

Description of the code:

  • In the java program code, two integer variable "j and k" is defined, that stores a value, that is "10 and 8", in its respective variable.
  • After storing the value it uses the "j and k" variable, in this, it increments the value of j with 2, and in the k variable, it adds the value of j and stores the value in k.
  • After incrementing the value, the print method is used that prints the value of "j and k", i.e, "12 and 20".
8 0
3 years ago
Other questions:
  • What will happen with communication methods in five years?
    8·1 answer
  • With dhcp, a device borrows, or ____ an ip address while it is attached to the network.
    6·1 answer
  • Your organization's network has multiple layers of security devices. When you attempt to connect to a service on the Internet. H
    9·1 answer
  • Syntax errors ________. a. result from an attempt to perform an operation that cannot executeb. are errors such as misspelled ke
    14·1 answer
  • What is the decrypted binary
    9·1 answer
  • Most network behavior analysis system sensors can be deployed in __________ mode only, using the same connection methods as netw
    8·1 answer
  • Write a program, called compute_stats.c, which opens a data file, called numbers.txt, which contains of a list of positive integ
    10·1 answer
  • write query for all products reutrn product name with its amounts due, paid, canceled, and refunded, order the result by product
    7·1 answer
  • Being a part of an organization or giving back to the community is which rewards of work factor?
    6·1 answer
  • What is cache memory?Mention its importance. ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!