Create and initialize an array called testmarks

Assignment Help JAVA Programming
Reference no: EM131260712 , Length: 4

Assignment

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.

Question 2

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.

Question 3

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.

Reference no: EM131260712

Questions Cloud

Find the mix of standard and deluxe golf bags : Find the mix of standard and deluxe golf bags to produce per week that maximizes weekly profit from these activities. - What is the value of the profit?
What steps taken to minimize atrophy of skeletal muscles : What steps might be taken to minimize atrophy of the skeletal muscles in patients confined to bed for prolonged times? Include at least two scholarly references.
Trend in american medicine-an entire : There is a major new trend in American medicine-an entire new professional physician group known as "hospitalists." Currently the American public has a very poor understanding of what a hospitalist is and what role he or she performs in patient ca..
Identify any gradually varied flow profiles : Determine what changes take place due to the presence of the transition. In your analysis include all relevant rapidly varied flow calculations, identify any gradually varied flow profiles, and sketch the water surface and energy grade line.
Create and initialize an array called testmarks : 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 - Prompt the user to enter a mark and store an inputted value on the variable mark
Write a research about origin of flowering plants : Write a research about Origin of Flowering Plants for Botany majer. The format of citation is American Journal of botany, and all resources must be primary resources.
Which element in the row exerts the greatest attraction : Which element in the row exerts the greatest attraction on its valence electron(s), and which element exerts the least attraction on its valence electron(s)?
Formulate watsons production mix decision : Formulate Watson's production-mix decision as a linear programming problem, and solve. How many tables and bookcases should be produced each week? What will the maximum profit be?
Find the nature of the water surface and energy grade line : The discharge is 33 m3 /s. At the entrance to the channel, the depth is 0.68 m, and at the downstream end a free-outfall condition exists. Perform a profile synthesis to determine the nature of the water surface and energy grade line.

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