Reference no: EM131250397 , Length: 4
Assignment 1
Answer all questions. Make sure you run the program on net bean and submit your programs via ethuto.
Question 1
Write a program that will prompt the user to enter his/her name and a number. Use a while loop that will display the user name times the entered number.
Hint: the following steps must be performed:
- Declare variable name of type String, number of type integer and a count of type integer set to 0. Count is a loop control variable.
- Create the Scanner object.
- Prompt the user to enter the name and store the input on variable name.
- Prompt the user to enter the number and store the input on variable number.
- Create a while loop statement that will loop while count is less than number.
- Inside the loop display the name and increment count.
- Outside the while loop, display name, number, and count.
Question2
Given the following table of the test scores, create the if else ifstructure that will model the inputted test score. Display the message "not within range" for any value not within the range.
Range
|
remarks
|
80-100
|
Excellent
|
70-79
|
Very good
|
50-69
|
Good
|
40-49
|
Poor
|
0-39
|
Very poor
|
Hint: the following steps must be performed:
- Declare a variable mark of type integer and variable remarks of type String.
- Create the Scanner object.
- Prompt the user to enter a mark and store an inputted value on the variable mark
- Use if else if to check the range of the mark. If the mark is within the expected range, then set a remark to a specific value.
- Lastly, display the mark and remarks.
Questions 3 and 4 help you understand arrays 1 and 2 dimensional arrays.
Question3
As a Nanabolela secondary school IT teacher, you are required to create and initialize an array called testmarks with the values provided below. Use a for loop to add 2 to each test mark.
Hint: Follow the following steps
- Create and initialize an array testmarks of type integer with the value provided above.
- Use afor loop to manipulate an array by adding 2 to each test mark.
- Use a second for loop that will calculate sum of test marks.
Question 4
45
|
47
|
25
|
45
|
14
|
17
|
36
|
4
|
1
|
3
|
8
|
9
|
14
|
17
|
011
|
47
|
47
|
63
|
02
|
0
|
11
|
- Given the following table create and initialize the two-dimensional array called tableNumbers of type integer.
- Use nested loops that will add 12 to each element in an array.
- Use nested loops that will get the average of the data. Hint get total and count
Questions 5 and 6 helps you better with methods.
Question 5
1. Create a method called Calculate() of type integer that will calculate and return back the total. This method has two parameters num1 and num2.
2. Call method Calculate() passing 9 and 10.
3. Create a parameterless method of type void called DisplayName(). This method will prompt the user to enter his or her name and display the message "your user name is" followed by the user name.
4. Call the method DisplayName()
Question 6
As a Leseding high school IT teacher, you are required to create a program that will subtract 5 from the learner's marks.
Inside The main Method
1. Create and initialize array called MarksArray that will hold 5 marks.
2. Call a void method subtractFive() passing MarksArray as an argument
3. Call a returning value method returnAverage() passing MarksArray
Method implementation
4. Create a method SubtractFive() that will receive MarksArrayas a parameter, and use a for loop to subtract 5 from each element.
5. Create a method returnTotal() that will receiveMarksArrrayas a parameter, it will use a while loop to sum all the marks
Questions 7 and 8 covers Classes and Objects
Question 7
Complete the following class.
Public class Student
{
1. Student has three fields name, age and student number
2. Provide an overloaded constructor that will initialize these 3 fields
3. provides the getters methods for each field
Public static void StudentApplication(String args[]) // Assume the following initialisation are done.
{ String name="john";
Intage =26;
IntstudentNumber= 209075937;
4. Create an object called myStudent passing the above data
5. Display information using getters methods.
}
}
Question 8
- Create a class called Lecturer.
- Lecturer has the following attributes, name, staffNumber, salary.
- Create a constructor that will initialize these fields, if a salary is less than 0 set it to0.
- Create getters methods for all the fields.
Here is the test Application named LecturerApplicationthat will demonstrates class Lecturer
Public static void LecturerApplication(String args[])
{ String name=John;
IntstaffNumber =17095;
doublesalary= -99.99;
- Create an object called employeeObject passing the above data.
- Display information using getters methods.
Briefly discuss the four tier system for financial reporting
: Briefly discuss the four tier system for financial reporting (Use an appropriate diagram or table as part of your answer.
|
Calculate the amount of net income
: ABC Company began operations in June, 2017 by selling common stock to owners in exchange for $70,000 cash. During 2017, ABC Company entered into the following transactions: On June 23, ABC Company purchased inventory for $40,000 cash. Calculate the a..
|
Calculate amount of interest expense related to this loan
: Franklin Co. borrowed $60,000 from a bank on July 1, 2017 and agreed to pay it back in ten months at an interest rate of 16% per year. Calculate the amount of interest expense related to this loan reported in Franklin Co.'s 2018 income statement. Do ..
|
Calculate xyz company total liabilities
: XYZ Company had total assets of $500,000 and total liabilities of $200,000 at January 1, 2016. At December 31, 2016, XYZ Company had total equity of $400,000. XYZ Company reported a return on investment (ROI) of 16% for 2016 and a net income of $93,0..
|
Create and initialize an array testmarks of type integer
: Write a program that will prompt the user to enter his/her name and a number. Use a while loop that will display the user name times the entered number - Create a method called Calculate() of type integer that will calculate and return back the to..
|
How is ge aviation structured to meet customer demands
: How is GE Aviation structured to meet customer demands? If you could please provide a few outside resources (websites) where I can do more research and find information on this question that would be great!
|
What is the efficient outcome of this game
: What is the efficient outcome of this game? - How can p0 be set so that the buyer has the incentive to accept delivery regardless of the seller's investment?
|
How supply chain impact distribution of assets and resources
: Explain how supply chain impacts distribution of assets and resources. The memo should include a visual representation of an example supply chain network using the "Shape" or SmartArt" option in MS Word.
|
Aspect of the performance appraisal process
: In your opinion, what's the most challenging aspect of the performance appraisal process?
|