Question: (JAVA/Chapter 4) Selection structure. Assignment : Write a Java program to display a business card. The program will ask for a password and if the

(JAVA/Chapter 4) Selection structure.

Assignment: Write a Java program to display a business card. The program will ask for a password and if the password is correct, ask for the persons first name, last name, title, department, office phone number, mobile phone number, email address, and the office mail code (one character code). Generate a random number between 10.1 and 1000.1 and display the number with 2 digits after the decimal point on the business card. Als o, display the LOG base 10 of the random number and the number raised to power of 3. Display these numbers with 4 digits after the decimal point.

Process and additional criteria:

Assume the correct password is java. Password is case sensitive.

If the password is incorrect, issue an error message and terminate the program.

If the email address does not have an @ sign in it, show the error code: Incorrect email address instead of the given email address.

Do not use the System.exit() method to terminate the program.

Pick the most suitable data type for your variables.

The printf method covered in chapter 4 could be of help in displaying number with a certain number of digits after the decimal point.

SAMPLE RUN:

Enter your password: Java

ERROR Invalid password the program will terminate

Enter your password: java

Enter your first name: Alan

Enter your last name: Turing

Enter your title: Professor

Enter your department: Computing & Information Technology

Enter your office phone number: 505-555-5151

Enter your mobile phone number: 505-555-5152

Enter your email: alan.turing@genious.com

Enter your office mail code (one character code): H

Here is your official business card:

*------------------------------------------------------------------------------*

|

| Alan Turing

| Professor

| Computing & Information Technology

| Office Phone: 505-555-5151

| Mobile Phone: 505-555-5152

| alan.turing@genious.com

| Mail code: H

| Your assigned

random number: 120.88

| The log base 10 of your random number is: 2.0824

| The random number raised to the power of 3 is: 1766295.4655

*------------------------------------------------------------------------------*

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!