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

  Write java program to utilizes gui with five text fields

Write down the program called MaxMinAvgGUI.java which utilizes GUI with five(5)text fields which asks user to enter 5(five) decimal numbers. 1(one)number in each text field.

  Write a program called drawing in the form of a public class

Write a program called Drawing in the form of a public class Drawing that extends a Java JFrame and provides the following features.

  Create a 2-dimensional array for the volume of concrete

Your Company constructs concrete hemispherical domes that range in diameter from 40 to 90 feet and increments of 5 feet.

  Computing the time complexity using the big-o notation

You are required to calculate the time complexity using the big-O notation of the Algorithm_2 given by the following methods defined by the following Java code.

  Modify the homestead furniture store application

Design an application for the homestead furniture store that gets sales transaction data including an account number customer name and purchase price.

  Method that reflects overloading

Example of a method that reflects overloading, and one that reflects polymorphism

  Program that uses random instead of scanner to play

Write a Java Program that uses Random instead of Scanner to play many rounds of Rock Paper Scissors. The user and computer will each randomly pick one and common rules of winning apply

  Write a complete java program that draws a scatterplot

Write a complete Java program that draws a scatterplot by reading in points of data from a file and displaying them. The input data file consists of a pair of integers representing a point on each line of the file; the first integer is the x coord..

  What is overloading and what is overriding

What is overloading and what is overriding? Wrtie JAVA code code to explain it.

  Create an algorithm in java

Create an algorithm in java which will provide the Dijkstras shortest path in a graph provided by the user - The output should display the shortest path.

  Public float usefulload()

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Create a java gui app implement inside a main method

Create a Java GUI app, implement the following criteria inside a main method 1) set up a visible frame with width 500, height 300; 2) frame title is "CSE205 Frame app"; and 3) setDefaultCloseOperation to EXIT_ON_CLOSE.

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