Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description: The classic HelloWorld program is a simple program used to illustrate the basic syntax of a programming language. In its simplest form, the program

Description:

The classic HelloWorld program is a simple program used to illustrate the basic syntax of a programming language. In its simplest form, the program displays the text Hello, World! to the user. It can serve as a great starting point to explore and learn more complex concepts.

Assignment:

Create a MultiGreeter class with the following capabilities:

Feature

Signature

Requirement

Constructors

MultiGreeter()

No-argument constructor; greeter will have 1 default greeting Hello;

MultiGreeter(int maxGreetings)

Creates a greeter that can hold up to maxGreetings greeting strings. MaxGreetings must be non-negative--it can be 0.

Methods

getMaxGreetings() : int

Returns the maxGreetings, that is, the maximum number of greetings that can be added to this Greeter

getNumGreetings(): int

Returns the actual number of greetings added to this greeter.

addGreeting(String greeting) : boolean

Adds a greeting to this Greeter. If Greeter already has maxGreetings added, the greeting will not be added and the method will return false; otherwise the method will return true.

getGreetings(): String []

Returns an array containing the greeting strings added to this Greeter

greet(String name) : String

Returns a salutation in the form greetingString, name!, where

greetingString is one of the greeting strings added to the Greeter picked at random. If not greetings have been added, the system will use the default greeting "Hello"

name a provided name.

greet() : String

As specified above, however the system will use the default name, World

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions