Create and initialize an array testmarks of type integer

Assignment Help JAVA Programming
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.

67

45

26

28

83

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.

23

45

26

28

83

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.

Verified Expert

The paper describes about the use of different types of variables in java and the loop conditions like while and for. It also describes about the use of conditional statements like if and if else. It later goes on the concepts of arrays and multidimensional arrays. The paper later describes the usage of methods in java and the concepts like how to send values to a method and how to return a value from the method. Later it describes about the classes and objects and then explaining how to initialize the objects using constructors and how to access the private members of the class using the getter and setter methods.

Reference no: EM131250397

Questions Cloud

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?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd