Create a program that takes in a student’s full names and marks for 3 In-class exercises, then calculate the average of this marks. This average mark is then categorized as follows: Marks obtained Grade Level Message 80 – 100 1 Magnificent!!
70 – 79 2 Excellent!!
60 – 69 3 Good work!!
50 – 59 4 Good!!
0 – 49 0 Fail – Try again next Year!!
Greater than 100 or less than 0 X Invalid Marks!!, Marks too high. Or Invalid Marks!!, Negative marks not allowed.
Sample run 1: Enter student full names: Goodluck Johnathan Enter 3 marks separated by spaces: 78 94.6 88
Output: Student name: Goodluck Johnathan Grade Level: 1 Comment: Magnificent!! Sample run 2: Enter student full names: Ellen Johnson Sirleaf Enter 3 marks separated by spaces: 200 104.87 99.9
Output: Student name: Ellen Johnson Sirleaf Grade Level: X Comment: Invalid Marks!!, Marks too high
Create a program that takes in two words, check for equality ignoring the cases, if the words are equal the print the word in upper case with an appropriate message however if the words are different then print the two words in lower case with an appropriate message.
Sample run 1:
Enter two words separated by spaces: Welcome WELCOME
Output: You have only entered one word: “WELCOME”
Sample run 2: Enter two words separated by spaces: NUST Students
Output: You have entered two words: “nust” and “students”
Given any whole number from user input, check whether it’s a positive or negative number. If the number is negative then increment it by 3 and multiply the result by 4, however if it’s a positive number then decrement by 4 and multiply it by 3.
a) Create a flowchart to be followed to solve the above task
b) Create a java program using your flowchart and see samples below
Sample run 1:
Enter a whole number: 4
Output: The Number 4 is above zero hence,
Result of the calculations = 0
Sample run 2:
Enter a whole number: -5
Output: The Number -5 is below zero hence,
esult of the calculations = -8
I. Make use of a loop of your choice and write statement(s) that will display all array elements indicating the Municipality’s name as follows: (6)
Municipality 1: Steve Tshwete
Municipality 2: Nkomazi
etc
VenueControlClass
Code a method problemlab(). This method has no parameters and is void. This method displays all computer labs that have less working computers that number of seats. Expected output (take note of headings and other formatting): Problem computer labs Building name: Engineering Venue number: 1.35 Number of seats: 50 Number of working computers: 30 ------------------------- Building name: Engineering Venue number: 1.24 Number of seats: 40 Number of working computers: 35 ------------------------- 5 Applications Development Foundations I 8 Code the add() method as follows: 9 Code a method, menuControl() that is void. This method controls the application. Processing includes: Call the menu() method. Use a switch statement and depending on the option returned by menu(), it calls the appropriate method(). Refer to the menu() for the available options.
VenueControlClass
5. Code a method named createComputerLab().
Required: a. Define a Scanner variable to read from the keyboard. b. Define variables for building name, room number, number of seats and number of working computers. Prompt the user to type data values for each of the variables and read the values from the keyboard. c. Define and create a ComputerLab object from the data read from the keyboard. d. Return this ComputerLab object.
6. Code a method displayAllRooms(). This method has no parameters and is void. This
method displays all objects in the array. Required: a) Display a heading. 4 Applications Development Foundations b) Loop through the array and use the show() of every object to display the object details. c) Print a line after each object is displayed.
VenueControlClass
This class has a menu control method that allows users to add a Venue or ComputerLab object to an array.
Code the attributeas and methods as specified.
1. Code an array that can hold 20 Venue objects. 2. Code the numberOfVenues attribute. 3. Code a no-argument constructor. In this constructor, a) Add 3 Venue objects to the venues array. b) Add 3 ComputerLab objects to the venues array. c) Set numberOfVenues to 6. 3 Applications Development Foundations. 4. Code a method menus() that returns an int value. This value represents the option the user has chosen from the available menu options. Required: a) Define a Scanner variable to read from the keyboard. b) Define an int value, named option. c) Display a menu in the following format: 1: Add room 2: Display rooms 3: Display problem labs 4: Exit d) Read the user’s option from the keyboard into the variable option. e) Return the option read from the keyboard.
ComputerLab
-numberWorkingComputer:int
+<>ComputerLab()
++<>ComputerLab(int,String,String,int)
+setNumberWorkingComputers(int):void
+getNumberWorkingComputer():int
+toString():String
+show():void
+problemVenue():boolean
Code the attributes and methods as per diagram for the ComputerLab class. 1 Remember to call the superclass constructors in the coding of the ComputerLab constructors. 2 Remember to call the superclass toString() in the ComputerLab toString(). 3 Code the show() method. This method is void and displays the details of a ComputerLab object. Again, remember to call the show() of the superclass. Building name: Engineering, Venue number: 1.24, Number of seats: 40, Number of working computers: 35 4, Code the method problemVenue. This method returns a boolean value of true if the numberSeats in the computer lab is more than the numberWorkingComputers, else a boolean value of false is returned.
Create a program that takes in a student’s full names and marks for 3 In-class exercises, then calculate the average of this marks. This average mark is then categorized as follows: Marks obtained Grade Level Message 80 – 100 1 Magnificent!! 70 – 79 2 Excellent!! 60 – 69 3 Good work!! 50 – 59 4 Good!! 2 DUE DATE: MONDAY 06 OCTOBER 2021 BEFORE 23h59 0 – 49 0 Fail – Try again next Year!! Greater than 100 or less than 0 X Invalid Marks!!, Marks too high. Or Invalid Marks!!, Negative marks not allowed. Sample run 1: Enter student full names: Goodluck Johnathan Enter 3 marks separated by spaces: 78 94.6 88 Output: Student name: Goodluck Johnathan Grade Level: 1 Comment: Magnificent!! Sample run 2: Enter student full names: Ellen Johnson Sirleaf Enter 3 marks separated by spaces: 200 104.87 99.9 Output: Student name: Ellen Johnson Sirleaf Grade Level: X Comment: Invalid Marks!!, Marks too high.