- Include the following comments at the top of your source codes
// –
// Assignment (include number)
// Written by: (include your name and student id)
// For COMP 248 Section (your section) Fall 2020 //
- In a comment, give a general explanation of what your program does. As the programming questions get more complex, the explanations will get lengthier.
- Include comments in your program describing the main steps in your program.
- Display a welcome message.
- Display clear prompts for users when you are expecting the user to enter data from the keyboard.
- All output should be displayed with clear messages and in an easy to read format.
- End your program with a closing message so that the user knows that the program has terminated.
Question 1 Display a design
Write a complete Java program that prints the following output:
/ \//
\///
///\
//\
/
All done!
Question 2 Why my assignment is late
Write a Java program that helps a student write the text to an email explaining to their professor why their assignment is late.
Your program should prompt the user to enter the following information.
Note: String inputs are to be one word and the number input is to be stored in a variable of type double.
- The first or last name of your instructor
- Your name
- A food
- A number between 37.0 and 40.0
- An adjective
- A color
- An animal
After the strings and double are input, they should be substituted into the story below and output as an email to your prof using a single System.out.println() statement to the console (See sample output in figure 1).
Dear professor [Instructor name],
I am sorry that I am unable to turn in my computer assignment at this time. First, I ate a rotten [food], which made me turn [colour] and extremely ill. I came down with a fever of [fever]. Next my [adjective] pet [animal] must have smelled the remains of the [food] on my USB key (which is where my program was stored) because he ate it.
I am currently rewriting my programs and hope you will accept my assignment late.
Sincerely,
[student name]
Here is a sample output screen. User input is marked by
Question 3 Manipulating variables of type String (6 pts)
Write a program that
- Displays a welcome message of your choice.
- Prompts the user for two words (can contain upper and lower case letters, digits and special characters excluding whitespace characters) then displays the number of characters as well as the first and last characters of each word.
- Next, create 2 new words such that the first word starts and ends with the 1st and last characters of the second word and the second word starts and ends with the 1st and last characters of the first word. Display the new words.
- Displays a closing message.
You can assume that the user enters 2 words with at least 2 characters each.
Here are a couple of sample output screen. User input is marked by
Reviews
There are no reviews yet.