Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use java to solve it Lab work: You are required to study the relevant materials prior to the lab. In the lab, your TA will

use java to solve it

image text in transcribed

Lab work: You are required to study the relevant materials prior to the lab. In the lab, your TA will explain the algorithm (input-process-output) and help you to translate it into a computer program. Although there is no lab submission, you need to complete this so that you can use the logic in the future projects and labs. A person's name is a required field for many documents. For example, when you create a profile online, you are asked to enter your last name, first name, and middle name if any. When entering your name, you don't have to worry about entering your name in a particular case because it will be most likely be converted to title case in your profile. For example, last name Smith, entered in any one of the cases such as smith, sMith, Smith, smiTH, etc., will be converted to Smith in the profile. In this lab, you are going to write a computer program to convert a user-entered last name to an equivalent last name in title case. You can assume the following is true. Users always enter a valid last name. A last name is always one token/word. In order to solve this problem, we need to break the process into two pieces as following: First, convert the first letter to uppercase. Second, convert the rest of the name to lowercase. Each of the two sub processes can be broken into smaller pieces as following: First, convert the first letter to uppercase. o Create a sub string containing the first letter. o Convert the sub string to uppercase. Second, convert the rest of the name to lowercase. o Create a sub string containing all letters starting with the second letter. o Convert the sub string to lowercase. Finally, combine two final sub strings to one string, an equivalent last name in title case. smith Mith mith Smith In addition to the process, an algorithm must specify input and output. The following shows the entire algorithm. You need to translate it into a computer program. This means all logical steps need to be implemented in method main of the computer program. Here is the algorithm: Summary: Convert a user-entered string, such as a last name, into an equivalent name in title case. Read a user-entered last name. F input Create a sub string containing the first letter. Convert the sub string to uppercase. Create a sub string containing all letters starting with the second letter process Convert the substring to lowercase. Combine two final sub strings to one string, an equivalent last name in title case. Display the last name. output

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

More Books

Students also viewed these Databases questions

Question

Steps involved to investigate a cybercrime.

Answered: 1 week ago