Question
Assignment 8.3: What's Your Rock Star Name? (10pts) female rockersWrite a program to generate Rock Star names for you and your friends. Open a new
Assignment 8.3: What's Your Rock Star Name? (10pts)
female rockersWrite a program to generate Rock Star names for you and your friends.
Open a new file in eclipse called RockStar
Place a block comment at the top of the program with your name and the name of the assignment.
Next, welcome the user and prompt for the user's first and last name, as shown below.
Then greet the user by name, telling the user to Rock on!
Enter your first name: Jennifer
Enter your last name: Parrish
Rock on, Jennifer!
image source
Next, calculate the user's rock star name according to the below algorithm:
firstLen = length of firstName
if firstLen > 5 then firstLen = firstLen - 5
lastLen = length of lastName
if lastLen > 6 then lastLen = lastLen - 6
choose title from "Length of First Name" table based on firstLen
choose Instrument from "Length of Last Name" table based on lastLen
firstIntial = first letter of the user's firstName (Hint: call charAt method)
lastChar = last character of the user's lastName (Hint: call both charAt and length methods)
rockStarName = " title " + firstInitial + lastChar + Instrument
Length of First Name
Length Title
1 Fierce
2 Fearless
3 Brutal
4 Savage
5 Rough
Length of Last Name
Length Instrument
1 Guitar
2 Drums
3 Bass
4 Banjo
5 Violin
6 Cello
Note the use of the " " around the title part of the name below. Those " " are important. Don't forget about escape characters! (Lesson 7).
Note that you must use else if statements to receive full credit.
When your program is working identically to the output shown below (except the user may give different input), then submit RockStar.java to Canvas
Sample Output:
Enter your first name: Jennifer
Enter your last name: Parrish
Rock on, Jennifer!
Your rock star name is "Brutal" JH Guitar
Enter your first name: Geoff
Enter your last name: Chen
Rock on, Geoff!
Your rock star name is "Rough" GN Banjo
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started