Exercise 3A
Write a Java program that implements the following static methods for string manipulations that are useful for internet programming.
email
that accepts 3 string parameters
(a user's first name, last name and email domain) and returns
the user's email address as a string.
The email address is obtained by concatenating
the first character of the first name,
a dot ("."),
the last name,
the at sign ("@") and
the email domain.
homePage
that accepts 2 string parameters
(a user's last name and a web domain) and returns
the user's home page address as a string.
The home page address is obtained by concatenating
the string "http://",
the web domain,
the string "/~" and
the last name.
userId
that accepts 2 string parameters
(a user's first name and last name) and returns
the user's ID as a string.
The ID string is obtained by concatenating
the first character of the first name and
the first 7 characters of the last name.
password
that accepts 2 string parameters
(a user's first name and last name) and returns
an automatically generated password.
The password string is obtained by concatenating
the first 3 characters of the last name and
the last 3 characters of the first name.
main
that prompts the user
for the needed data, calls the methods you have developed and prints out
the resulting strings.
Use JOptionPane.showInputDialog
to get the user's
input and println
to print the output.
Exercise 3B
Define a classCD
that handles data known about a CD, such as
composer, title, publisher and owner.
The following methods are of interest:
Exercise 3C
Write a Java program that uses the class CD
from the last
exercise.
The class' main method should perform the following operations: