Write a program that creates a username based on the user's first and last name. Prompt...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that creates a username based on the user's first and last name. Prompt the user for and read the user's first name and last name separately. Print a string composed of the first letter of the user's first name, followed by the first five characters of the user's last name, followed by a random number in the range 10 to 90 (inclusive). • Output the username in all lowercase. You will then create a secret code number using the user's phone number. Prompt the user to enter a phone number, including the dashes. Create a code by taking the last four digits of the phone number, append a random number from 100 to 500 (inclusive) and then append the area code. i.e., if the number is 309-452-6029 with a random number of 422 would give you 6029422309. Finally, replace all O's in the secret code with $, all 8's with the letter B, and all 4's with the letter A: Output the code. You must use String methods to find the correct portions of the number. You must search for the second dash in the phone number to retrieve the last four numbers of the phone number. Sample output(user input in bold): • • Enter your first name: Susan Enter your second name: Johnson Enter your phone number with dashes-xxx-xxx-xxxx: 309-452-6029 Random number: 89 The username is: sjohns89 Random number: 422 Your secret code is: 6$29A223$9 Remember that the random numbers will generate different values than what is displayed here. Name your program UserSecretCode.java. Make sure your output matches the format above. Input will come from the keyboard using the Scanner class. Output will be displayed on the console Write a program that creates a username based on the user's first and last name. Prompt the user for and read the user's first name and last name separately. Print a string composed of the first letter of the user's first name, followed by the first five characters of the user's last name, followed by a random number in the range 10 to 90 (inclusive). • Output the username in all lowercase. You will then create a secret code number using the user's phone number. Prompt the user to enter a phone number, including the dashes. Create a code by taking the last four digits of the phone number, append a random number from 100 to 500 (inclusive) and then append the area code. i.e., if the number is 309-452-6029 with a random number of 422 would give you 6029422309. Finally, replace all O's in the secret code with $, all 8's with the letter B, and all 4's with the letter A: Output the code. You must use String methods to find the correct portions of the number. You must search for the second dash in the phone number to retrieve the last four numbers of the phone number. Sample output(user input in bold): • • Enter your first name: Susan Enter your second name: Johnson Enter your phone number with dashes-xxx-xxx-xxxx: 309-452-6029 Random number: 89 The username is: sjohns89 Random number: 422 Your secret code is: 6$29A223$9 Remember that the random numbers will generate different values than what is displayed here. Name your program UserSecretCode.java. Make sure your output matches the format above. Input will come from the keyboard using the Scanner class. Output will be displayed on the console
Expert Answer:
Answer rating: 100% (QA)
Heres a Java program named UserSecretCodejava that creates a username based on the users first and l... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
An investor places $1000 in an account that earns 5% interest with discrete end-of-period compounding, what will be the value of the account in 3 years? Please show me the formula and the step by...
-
Units produced and sold Total revenues and costs Sales revenue Direct materials costs Direct labor costs Variable manufacturing overhead Fixed manufacturing overhead Variable marketing and...
-
You have been employed to create program to assist the manager of a coffee shop. You decide to make a prototype application in Java to show what you can do, and to be able to ask the manager what...
-
A teacher has just given an algebra exam. What are some of the statistics she could compute?
-
Standard design practice, as exhibited by the solutions to Probs. 839 to 843, is to assume that the bolts, or rivets, share the shear equally. For many situations, such an assumption may lead to an...
-
Lu Corp. erected and placed into service an offshore oil platform on January 1, 2017 at a cost of $10 million. Lu is legally required to dismantle and remove the platform at the end of its nine-year...
-
Stuart Rankin, manager of the specialty store All Things Scottish, is interested in devising a way to recommend different types of Scotch whisky to customers based on their preferences among Scotches...
-
Use the Summer Time Supply Corp. data from Problem 12-62A. Requirements 1. Prepare the 2012 statement of cash flows by using the direct method. 2. How will what you learned in this problem help you...
-
A model that I have discussed before was a decision tree model, this type of model helps to weigh the different outcomes that can occur from making a certain decision. In my job, I may not use a...
-
You recently received the following e-mail from a client and friend: Hey Great Student, I cannot believe it is almost year end! Only a few days before its 2019. As you recall, I was lucky enough to...
-
You are a system administrator that manages a set of Linux boxes, one of those boxes are facing problem causing it to freeze. Properly list the needed steps and commands to tackle the main process...
-
Amanda agrees to sell Louise her computer. Louise pays $1,300 for it today. She notices that, theoretically, she could have paid money continuously to Amanda over the next 8 years, with interest...
-
Calculate the cost of equity, the cost of debt and the weighted average cost of capital (WACC) of the project risk free rate is 3%, beta factor is 2.49, 75% equity and 25% debt, market return is 9%
-
2 Classify each type of numerical data as discrete (D) or continuous (C). a number of homes with solar power b patients' body temperatures c sizes of the crowds at rock concerts d star ratings of...
-
Using the 2021/2022 tax rates, calculate and explain Sara's total capital gains tax liability arising from the sale of her shareholdings in Fair church, Tesco plc and Stanton. Fairchurch is...
-
1. Create three (2) classes named Party, Dinner Party, and DemoParty. 2. In the Party class, declare a private variable of int type named numGuests. 3. Create a getter method named getNumGuests()...
-
A For an ideal binary liquid solution with P> P, which relation between X (mole fraction of A in liquid phase) and Y(mole fraction of A in vapour phase) is correct? (a) YA XB Y. A YB XB > A X < A YB...
-
During the year land was revalued and the surplus reported as Revaluation surplus; and an asset costing 80,000, written down to 38,000, was sold for 40,000. Identify the cost of any non-current...
-
A university posts its employees salaries at http://cs.armstrong.edu/liang/data/Salary.txt. Each line in the file consists of a faculty members first name, last name, rank, and salary (see...
-
Write a program that reads a connected graph from a file. The graph is stored in a file using the same format specified in Programming Exercise. Your program should prompt the user to enter the name...
-
Write a program that stores an array of the five int values 1, 2, 3, 4, and 5, a Date object for the current time, and the double value 5.5 into the file named Exercise17_05.dat.
-
A regulation basketball is initially flat and is then inflated to a pressure of approximately \(24 \mathrm{lb} / \mathrm{in}^{2}\) absolute. Consider the air temperature to be constant at...
-
The presence of raindrops in the air during a heavy rainstorm increases the average density of the air-water mixture. Estimate by what percent the average air-water density is greater than that of...
-
Assume that the air volume in a small automobile tire is constant and equal to the volume between two concentric cylinders \(13 \mathrm{~cm}\) high with diameters of \(33 \mathrm{~cm}\) and \(52...
Study smarter with the SolutionInn App