Please be aware of the coding policy for this course. (if there are two students or more with the same code; all involved will get zero regardless of the source). So no copy pasting from the web, and no sharing of code. If you have questions, please let me know. Good luck!Deadline: 16-Mar-2019i need this assignment to be done by the 15th of march, 2019
it401_assignment_2_questions.docx

Unformatted Attachment Preview

College of Computing and Informatics
Assignment 2
Deadline: Saturday 16/03/2019 @ 23:59
[Total Mark for this Assignment is 6]
Student Details:
Name: ###
ID: ###
CRN: 23102
Instructions:

This Assignment must be submitted on Blackboard (WORD format only) via the allocated
folder.

Email submission will not be accepted.

You are advised to make your work clear and well-presented, marks may be reduced for
poor presentation. This includes filling your information on the cover page.

You MUST show all your work, and text must not be converted into an image, unless
specified otherwise by the question.

Late submission will result in ZERO marks being awarded.

The work should be your own, copying from students or other resources will result in ZERO
marks.

Use Times New Roman font for all your answers.
Question One
Pg. 01
Learning
Outcome(s):
– Use
programming
language
elements
including syntax,
data types,
conditional
statement, control
structures,
procedures and
arrays in order to
create a program
based on
specification.
– Use Integrated
Development
Environment (IDE
for the editing,
building,
debugging, and
testing of
programs.
Question One
1 Mark
Write a Java program (code + screenshot of output) that takes a user input
temperature and displays an output as follows:
Temperature
temperature > 40
40 ≥ temperature > 25
25 ≥ temperature > 15
15 ≥ temperature
Sample run1:
Please input the temperature: 45
Hot
Sample run2:
Please input the temperature: 40
Warm
Sample run3:
Please input the temperature: 20
Nice
Sample run4:
Please input the temperature: 5
Cold
Sample run5:
Please input the temperature: -10
Cold
Answer
Output
Hot
Warm
Nice
Cold
Question Two
Pg. 02
Learning
Outcome(s):
– Use
programming
language
elements
including syntax,
data types,
conditional
statement, control
structures,
procedures and
arrays in order to
create a program
based on
specification.
– Use Integrated
Development
Environment (IDE
for the editing,
building,
debugging, and
testing of
programs.
Question Two
1.5 Mark
Write a Java program (code + screenshot of output) that takes a user input
temperature and weather and displays an output as follows:
Weather
Temperature
Output
ANY (sunny
OR cloudy)
temperature > 40
Stay at home
sunny
Go to the mall
40 ≥ temperature > 25
Go to the park
cloudy
sunny
Stay in the shade
25 ≥ temperature > 15
Have a BBQ party
cloudy
sunny
Walk under the sun
15 ≥ temperature
cloudy
Sample run1:
Please input the weather (sunny OR cloudy): sunny
Please input the temperature: 50
Stay at home
Sample run2:
Please input the weather (sunny OR cloudy): cloudy
Please input the temperature: 50
Stay at home
Sample run3:
Keep warm
Question Two
Pg. 03
Please input the weather (sunny OR cloudy): sunny
Please input the temperature: 40
Go to the mall
Sample run4:
Please input the weather (sunny OR cloudy): cloudy
Please input the temperature: 26
Go to the park
Sample run5:
Please input the weather (sunny OR cloudy): sunny
Please input the temperature: 25
Stay in the shade
Sample run6:
Please input the weather (sunny OR cloudy): cloudy
Please input the temperature: 16
Have a BBQ party
Sample run7:
Please input the weather (sunny OR cloudy): sunny
Please input the temperature: 15
Walk under the sun
Sample run8:
Please input the weather (sunny OR cloudy): cloudy
Please input the temperature: 5
Keep warm
Answer
Question Three
Pg. 04
Learning
Outcome(s):
– Use
programming
language
elements
including syntax,
data types,
conditional
statement, control
structures,
procedures and
arrays in order to
create a program
based on
specification.
– Use Integrated
Development
Environment (IDE
for the editing,
building,
debugging, and
testing of
programs.
Question Three
Convert the following while loop into a for loop.
int count = 0;
int numberOfCaptialLetters = 0;
String text = “Hello There How Are You?”;
while(count < text.length()) { char currentChar = text.charAt(count); if(Character.isUpperCase(currentChar)) { numberOfCaptialLetters++; } count++; } System.out.println("Total = " + numberOfCaptialLetters); Answer 1 Mark Question Four Pg. 05 Learning Outcome(s): - Use programming language elements including syntax, data types, conditional statement, control structures, procedures and arrays in order to create a program based on specification. - Use Integrated Development Environment (IDE for the editing, building, debugging, and testing of programs. Question Four 2.5 Mark Write a Java program (code + screenshot of output) that takes student grades as double values and then outputs the following: • The number of inputted grades • The average Sample run1: Please input student grade or (-1) to stop: 20 Please input student grade or (-1) to stop: 80 Please input student grade or (-1) to stop: 80 Please input student grade or (-1) to stop: -1 The number of student grades: 3 The average is: 60.0 Sample run2: Please input student grade or (-1) to stop: 50 Please input student grade or (-1) to stop: 100 Please input student grade or (-1) to stop: -1 The number of student grades: 2 The average is: 75.0 Sample run3: Please input student grade or (-1) to stop: -1 No grades inputted Answer ... Our essay writing service fulfills every request with the highest level of urgency. attachment