Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
=================================
// Result.java
public class Result {
private double arr[];
public Result(double[] numbers) {
this.arr = numbers;
}
public double findLowest() {
double min=arr[0];
for(int
i=0;i<arr.length;i++)
{
if(min>arr[i])
{
min=arr[i];
}
}
return min;
}
public double mean() {
double min=findLowest();
double sum=0,mean=0.0;
int cnt=0;
for(int
i=0;i<arr.length;i++)
{
if(arr[i]!=min)
{
cnt++;
sum+=arr[i];
}
}
if(cnt!=arr.length-1)
{
mean=0.0;
System.out.println("ERROR");
}
else
{
mean=sum/cnt;
mean=Math.round(mean * 10)/10.0;
}
return mean;
}
}
===========================================
// ResultAdjuster.java
import java.util.Scanner;
public class ResultAdjuster {
public static void main(String[] args) {
int size;
/*
* Creating an Scanner class object
which is used to get the inputs
* entered by the user
*/
Scanner sc = new
Scanner(System.in);
// Getting the input entered by
the user
System.out.print("How many results
do you have? ");
size = sc.nextInt();
double numbers[] = new
double[size];
for (int i = 0; i < size; i++)
{
System.out.print("Enter result #" + (i + 1) + ": ");
numbers[i] =
sc.nextDouble();
}
Result r=new
Result(numbers);
double avg=r.mean();
System.out.println("The adjusted
mean result is "+avg);
System.out.println("The lower
result was "+r.findLowest());
}
}
======================================
Output:
How many results do you have? 4
Enter result #1: 90.5
Enter result #2: 80.5
Enter result #3: 70.0
Enter result #4: 60.5
The adjusted mean result is 80.3
The lower result was 60.5
=====================Could you plz rate me well.Thank
You
hello i was given an assignment on object orientated programming and we were asked to use...
I need an OUTLINE ONLY (pseudocode/comments). DO NOT DO THE PROGRAMMING ASSIGNMENT. Part I: PA3 Outline (10 points). Create an outline in comments/psuedocode for the programming assignment below. Place your comments in the appropriate files: main.cpp, functions.h, dealer.cpp, dealer.h, dealer.cpp (as noted below). Place into a file folder named LastnamePA3, the zip the content and hand in a zip file to Canvas. Part II: PA3: Car Dealership (40 points) For Programming Assignment 3 you will be creating a program to...
Python 3.7 Coding assignment This Program should first tell users that this is a word analysis software. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file....
C Programming // use stdio.h, stdlib.h, string.h and math.h only. Write a program that prompts the user to enter a word that has 3 letters. Store this as a character array (i.e. strings in C). Create a new character array that stores the reverse of the word and display on the screen. Sample output is as follows: Enter a word with 3 letters> bee Word entered: bee Reverse word: eeb
The purpose of this assignment is to get experience with an array, do while loop and read and write file operations. Your goal is to create a program that reads the exam.txt file with 10 scores. After that, the user can select from a 4 choice menu that handles the user’s choices as described in the details below. The program should display the menu until the user selects the menu option quit. The project requirements: It is an important part...
COSC 1437 C++ Project Assignment 2 Poll Summary Utilize a dynamic array of structure to summarize votes for a local election Specification: Write a program that keeps track the votes that each candidate received in a local election. The program should output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. To solve this problem, you will use one dynamic...
Java Programming assignment. 1. Create a class called Square that takes a width parameter in the constructor. The Square class should have a draw() method that will draw the square on the screen. Create a class called TestSquare that will take width from the user, create an object of Square, and invoke the draw() method on the square object. Below is a UML diagram for the Square and Rectangle class: 3. Create a zip file that contains your Java programs....
CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...
please answer correctly and follow the code structure given [JavaFX/ Exception handing and text I/O] 1. Write a program for the following. NOTE that some of these steps are not dependent on each other. Using methods is mandatory. Make sure to use methods where it makes sense. a. Ask the user for a series of integers entered from the keyboard. Use a sentinel value such as 999 to end the input process. If the entered values are not integers, throw...
Could anyone please help with this Python code assignment? In this programming assignment you are to create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The count of how many numbers are in the file. The average of the numbers. The average is the sum of the numbers divided by how many there are. The maximum value. The...
I'm falling behind on my hw and I can really use a hand with using structures in C,++ C++ Object Oriented Programming Programming Assignment #4 Structures Create a structure representing a student. The member variables should include student name, student ID, and four test grades for the student (an array of four grades as a member variable). Prompt the user to enter the name, ID and the four test results. Store all the data in the structure. Calculate the average...