for the class ArrayAverage write a code that calculates the average of the listed numbers with a double result for the class ArrayAverageTester write a for each loop and print out the result
Q: Q2 Create MusicOrganizer project using BlueJ (i) Create a MusicOrganizer class and declare an…
A: import java.util.*; class MusicOrganizer{ public ArrayList<String> list; public…
Q: This is the question I am stuck on - In the exercises in Chapter 6, you created a class named…
A: The main objective of the program is to create three methods, called sortBySaleAmount,…
Q: Task 2: Geometricobject > +getPerimeter() : double +getArea():double Circle #radius:double - 1.0…
A: I give the code in java as per your requirement and also provide the code screenshot as well as…
Q: My issue: I keep getting the same errors that the while loop is illegal and the } are in the wrong…
A: The Problem with your code is you put { after Scanner scnr = new Scanner(System.in) instead of {…
Q: The Random class generates really random numbers.True or False
A: To be determine: True or False.
Q: Write a complete method to create an expanded String array. Method Specifications The method takes…
A: public class Main { public static String[] expandArray(String[] original) { // length of…
Q: Write a program that stores positive random integers in an array. • Get the element number(length of…
A: Here I have created an Arraylist and stored numbers from 1 to 50 into it. Now I have used the…
Q: Using the concept of classes in object-oriented programming Write java project for Motor Company…
A: I give the code in java along with the output and code screenshot
Q: Write the following program that id inspired by the photo app 1.Write a try catch block 2.break…
A: Program Plan: Create a class named PhotoApp. Define default constructor to initialize the variables…
Q: 10. Inside class StaticMethods, create the static method menu that displays a menu for the user to…
A: logic: - use while(true) to repeat loop until return or break is not encountered. read a single…
Q: 3) Create a method which generates and prints "n" random numbers. The method takes an int parameter…
A: Programming language is not mentioned so we are going to solve the problem in python language.
Q: Please paste the code for each completed class. Do not use ArrayList. Create Playlist.java,…
A: Solution: Note: Please make sure all the file in same folder while execution. make sure it should…
Q: c# Write a method which does not take any parameters and does not return a value. The method name…
A: Given data is shown below: c# Write a method that does not take any parameters and does not return a…
Q: Q1: Print an Array Explain in detail in English how the following outputArr method works? public…
A: - According to the restrictions placed on us because of our guidelines we are allowed to anser the…
Q: Exercise 1 - Number Guessing Game 2.0 Make a new Java Project called Lab3. Then, copy the…
A: The computer is going to randomly select an integer from 1 to 100. You'll keep guessing numbers…
Q: please remove break to exit the loop. Find another way to exit loops without using breaks in the…
A: Required: please remove break to exit the loop. Find another way to exit loops without using breaks…
Q: Fill in the missing lines of code to complete the below method, which prints out a 2D array to the…
A: A 2-D array is a collection of data cells.
Q: Create an array of objects and initialize them and show the data using class methodsHint:( create…
A: A class is a user-defined data type that combines data members and methods for manipulating that…
Q: Create a class named MyOctagon that contains the following method: /** Prints the area of the…
A: Here, Code instruction is given.
Q: Create a class called "Session12Lab". Create a method public static String[] mergeArrays(String[]…
A: Please find the answer below :
Q: Program is not running or is coming bback as blank, no errors are brought up. Am I missing…
A: Python code: Rectangle.py # Rectangle.py class Rectangle(object): # Declare public methods…
Q: 2. Create a Java project named clsProject2 Create a method called public static String [][]…
A: Import the required classes from io package like File and Scanner class. Method get_years-quarters…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: the answer is given below:-
Q: Exercise 2 - Even Number Sums Make a new class in the Lab3 project called EvenNumSum that reads an…
A: Write a Java program that will take an integer an input and then display the sum of even numbers…
Q: Code with comments and output screenshot. Thank you!! Write a java method that receives a string…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Inside class StaticMethods, create the static method printMyName() , as shown below that prints your…
A: package lab14; public class StaticMethods { public static void printJava() {…
Q: Using a single for loop, write code that prints by 5s from 0 to 100. Your code should also print…
A: We will write Java Code to solve the given problem.
Q: Must be in JAVA. Please Attached text code and output Create a new project and name it "Lab10" Write…
A: import java.util.*; public class Main { public static ArrayList<Integer>…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: ANSWER:
Q: static void RoomVolume(O { Scanner scan = new Scanner (System.in); System.out.println("Your room…
A: Start define function RoomVolume() in this input length , breadth and height print volume call…
Q: Create a method which generates and prints "n" random numbers. The method takes an int parameter…
A: Method: Method is a programming code that performs a specific task. A method written once can be…
Q: static void try( int data %3D System.out. ) catch (Arithmet System.out. }finally {
A: public class Main {public static void main (String [] args) {try {int data =…
Q: C#Write a method MyMethod which takes an int parameter named x. This method calculates the sum of…
A: Given: C#Write a method MyMethod which takes an int parameter named x. This method calculates the…
Q: Required: Create an executable class that uses the following methods. The following methods…
A: Algorithm: if condition then something if; elseif condition then…
Q: Write a method that calculates and prints both the maximum humidity and maimum temperatute values…
A: ANSWER
Q: Exercise PrintTriangles: Write a method to print each of the following patterns using nested-loops…
A: Since there are multiple questions and we are authorized to answer one question. So, we have…
Q: in a loop that continues until a user inputs a sentinel value of Z, ask the user whether the…
A: Program Understanding Here, we have used a while loop that continues until a user enters 'Z' to…
Q: *in java* Write a loop that subtracts 1 from each element in lowerScores. If the element was already…
A: PROGRAM CODE: import java.util.Scanner;public class Main { public static void main (String []…
Q: *** *** ***** ***** ****** **** *** *** *** ***** ***** *** ******* ***** ********* ******* ***** **…
A: Purpose: Left tree: In this program we need to create a Christmas tree and for this they have given…
Q: 11. Inside class StaticMethods, create the static method menuInteger that displays a menu for the…
A: PROGRAM CODE: // include the required librariesimport java.util.*;class StaticMethods{ // start…
Q: Write a program called LoopMethod (main method) that contains a method called printNums (method…
A: Algorithm: Step 1: Import required package. Step 2: Define “LoopMethod” class. Step 3: Define main…
Q: Assume class ArrayStack has been defined using the implementation in your textbook and that myStack…
A: Below is the answer with explanation:
Q: Question 1. Indefinite Loops and Random Numbers Write a Java program that has a method called…
A: The Java program illustrates the use of Random class, method and loop statements. The user input is…
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: ANSWER:-
Q: obj = new B(); obj.i=1; obj.j=2; obj.display(); class A { int i; void display()…
A: Answer: Explanation: In main method we assigned i value as 1 and j value as 2 in display method we…
Q: Write a program which does the following: 1. Create a class with the main() method. 2. Take a string…
A: /*We cannot print a normal string array using Arrays.toString(), if we create a data type words[]…
Q: Create a new Java project and make sure "Create project from template" is UNCHECKED). Use a…
A:
Q: Write a method that calculates and prints both the maximum humidity and maximum temperature values…
A: According to the information given:- We have to follow the instruction mention to get the max…
Q: AVA Write a program that plays a number-guessing game to guess a secret number randomly generated…
A: PROGRAM STRUCTURE: Import the required classes. Start the definition of the public class. Start…
for the class ArrayAverage write a code that calculates the average of the listed numbers with a double result
for the class ArrayAverageTester write a for each loop and print out the result
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images
- //Movie.java import java.util.Arrays; public class Movie { private String movieName; private int numMinutes; private boolean isKidFriendly; private int numCastMembers; private String[] castMembers; // default constructorpublic Movie() { movieName = "Flick"; numMinutes = 0; isKidFriendly = false; numCastMembers = 0; castMembers = new String[10]; } // overloaded parameterized constructorpublic Movie(String movieName, int numMinutes, boolean isKidFriendly, String[] castMembers) { this.movieName = movieName; this.numMinutes = numMinutes; this.isKidFriendly = isKidFriendly; //numCastMember is set to array lengththis.numCastMembers = castMembers.length; this.castMembers = castMembers; } public String getMovieName() { return this.movieName; } public int getNumMinutes() { return this.numMinutes; } public boolean getIsKidFriendly() { return this.isKidFriendly; } public boolean isKidFriendly() { return this.isKidFriendly; } public int getNumCastMembers() { return this.numCastMembers; } public…public class MyOutput { public static void main(String[] args) { int totalNumbers=6; Double dblAverage=4.5; Integer yourNumber= new Integer (20); int result=yourNumber+88; String myMessage="Exam"; System.out.println(totalNumbers+dblAverage+myMessage+result); }class overload { int x; double y; void add(int a , int b) { x = a + b; } void add(double c , double d) { y = c + d; } overload() { this.x 0; %3D this.y = 0; } %3D } class Overload_methods { public static void main(String args[]) { overload obj int a = 2; double b - 3.2; obj.add(a, a); obj.add(b, b); System.out.println(obj.x + } = new overload(); + obj.y); } #3Run the code
- 26. Assume the declaration of Exercise 24. A. Write the statements that derive the class dummyClass from class base as a private inheritance. (2 lines are { and }.) "A1 is { "A2 is "A3 is )) B. Determine which members of class base are private, protected, and public in class dummyClass. "B1 is dummyClass is a de/* TestCarSensor.java - program to test the CarSensor class.*/public class TestCarSensor{public static void main (String[] args){CarSensor generic = new CarSensor();CarSensor tempCel = new CarSensor("temperature sensor", -50, +300, "C"); CarSensor speed = new CarSensor("speed sensor", 0, 200, "km/h"); CarSensor speed2 = new CarSensor("speed sensor 2", 0, 200, "m/h"); // 2. test changing desc and limitsSystem.out.println ();System.out.println ( generic ); // display generic sensor (zero)generic.setDesc ("special sensor"); // change descriptiongeneric.setLimits (-5,5,"units"); // change limitsSystem.out.println ( generic ); // display generic sensor again// 3. test displaying object (calling .toString() )System.out.println ();System.out.println ( tempCel );System.out.println ( speed );System.out.println ( speed2 );// 4. test setlimits() ruleSystem.out.println ();System.out.println ( generic ); generic.setLimits (10, -10, "blah"); System.out.println ( generic ); generic.setLimits (-10,…Trace through the following program and show the output. Show your work for partial credit. public class Employee { private static int empID = 1111l; private String name , position; double salary; public Employee(String name) { empID ++; this.name 3 пате; } public Employee(Employee obj) { empID = obj.empĪD; пате %3D оbj.naте; position = obj.position; %3D public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $"+salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee empOne = new Employee("James Smith"), empTwo; %3D empOne.empPosition("Senior Software Engineer"); етрOпе.етpSalary(1000); System.out.println(empOne); еmpTwo empTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); %3D етpОпе empOne ;
- class WaterSort { Character top = null; // create constants for colors static Character red= new Character('r'); static Character blue = new Character('b'); static Character yellow= new Character('g'); // Bottles declaration public static void showAll( StackAsMyArrayList bottles[]) { for (int i = 0; i<=4; i++) { System.out.println("Bottle "+ i+ ": " + bottles[i]); } } public static void main(String args[]) { //part 1 //create the bottle StackAsMyArrayList bottleONE = new StackAsMyArrayList<Character>(); System.out.println("\nbottleONE:"+ bottleONE+ " size:" + bottleONE.getStackSize()+" uniform? "+ bottleONE.checkStackUniform());…public class test{ private static final int MAX = 100; private int[] sco; public test(int[] sco){ this.sco = sco; } private int comAvg() throws IllegalArgumentException{ int sum = 0; for (int i = 0; i < sco.length; i++){ int sc = sco[i]; if (sc < 0 || sc > MAX){ throw new IllegalArgumentException("Score (" + sc + ") is not in the range 0-" + MAX); } sum += sco[i]; } int av = sum / sco.length; return av; } public static void main(String[] args){ test test = new test(new int[] { 50, 70, 81 }); try{ int avgSc = test.comAvg(); char letG; if (avgSc < 60) letG = 'F'; else if (avgSc < 70) letG = 'D'; else if (avgSc < 80) letG = 'C'; else if (avgSc < 90) letG = 'B'; else letG = 'A'; System.out.println("\nAVG Score is " +…class TenNums {private: int *p; public: TenNums() { p = new int[10]; for (int i = 0; i < 10; i++) p[i] = i; } void display() { for (int i = 0; i < 10; i++) cout << p[i] << " "; }};int main() { TenNums a; a.display(); TenNums b = a; b.display(); return 0;} Continuing from Question 4, let's say I added the following overloaded operator method to the class. Which statement will invoke this method? TenNums TenNums::operator+(const TenNums& b) { TenNums o; for (int i = 0; i < 10; i++) o.p[i] = p[i] + b.p [i]; return o;} Group of answer choices TenNums a; TenNums b = a; TenNums c = a + b; TenNums c = a.add(b);
- class TenNums {private: int *p; public: TenNums() { p = new int[10]; for (int i = 0; i < 10; i++) p[i] = i; } void display() { for (int i = 0; i < 10; i++) cout << p[i] << " "; }};int main() { TenNums a; a.display(); TenNums b = a; b.display(); return 0;} Write a copy constructor for the above class TenNums. Make sure it performs deep copy. Group of answer choices TenNums(const TenNums& b) { p = b.p;} TenNums(const TenNums& b) { p = new int[10]; for (int i = 0; i < 10; i++) p[i] = b.p[i];} TenNums(const TenNums b) { p = new int[10]; for (int i = 0; i < 10; i++) p[i] = b.p[i];} TenNums(const TenNums b) { p = b.p;}public class Runner2{ public static void main (String[] args) { StudentRecord myRecord1=new StudentRecord(); //create one object //set values myRecord1.setName("Sai"); myRecord1.setAddresss("VZM"); myRecord1.setAge(22); myRecord1.setMathGrade(97); myRecord1.setScienceGrade(85.7); myRecord1.setEnglishGrade(88); StudentRecord myRecord2=new StudentRecord(); //create another object //set values myRecord2.setName("Pavan"); myRecord2.setAddresss("VSKP"); myRecord2.setAge(20); myRecord2.setMathGrade(89.5); myRecord2.setScienceGrade(80.6); myRecord2.setEnglishGrade(78.9); }} USE ARRAYS FOR THIS1- class Excep { 2- public static void main(String[] args){ 3 try{ int arr[]=(1,2}; 4 int x = arr[1]/arr[0]-1; 6 7 catch(ArithmeticException e) 8- { 9. System.out.printin("divide by e"); 10 } 11 catch(ArrayIndexOutofBoundsException e) 12- { 13 System.out.println("wrong indexing"); 14 15 finally 16- { 17 System.out.println("Runtime error"); 18 } 19 }} 20 Answer: