Rewrite the Assignment using C++ Class implementation. Name your class MyClass.
ID: 3646656 • Letter: R
Question
Rewrite the Assignment using C++ Class implementation. Name your class MyClass. Create all necessary functions and constructors. Write your own main() program to test and verify that your class works.Below is your previous Assignment and code
Write an application program that reads in a list of integer numbers and print out the sum of all numbers, the average, the lowest and the highest value entered. The first input number indicates how many numbers the program is going to read. For example, if the first number
import java.io.*;
import javax.swing.JOptionPane;
class array
{
public static void main(String args[])
{
String firstNumber;
int i=0,size;
float average=0,sum=0;
firstNumber =JOptionPane.showInputDialog ( "Enter the number of integers" );
size=Integer.parseInt ( firstNumber);
int a[]=new int[size];
for(i=0;i<size;i++)
a[i]=Integer.parseInt
(JOptionPane.showInputDialog
( "Enter the values" ));
int min=a[0],max=a[0];
for(i=0 ;i<size;i++)
{
sum=sum+a[i];
if(a[i]<min)
min=a[i];
if(a[i]>max)
max=a[i];
}
average=(sum/size);
JOptionPane.showMessageDialog(null,"result: sum"+sum+" min:"+min+" max:"+max+" average:"+average);
}
}
Explanation / Answer
This porgram works 100%,done directly using main.First try #include #include using namespace std; int main() { int numbers=0; int i=0,size; char c; float average=0,sum=0; coutnumbers; size=numbers; int a[100]; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.