To evaluate the predictive performance of a model constructed from a two-class data set, k-fold cross-validations are frequently applied. Describe the concept of cross-validation, and two performance measures, sensitivity and specificity, respectively.
In: Computer Science
Use the web or other resources to research at least two criminal or civil cases in which recovered files played a significant role in how the case was resolved.
Need 250 words
In: Computer Science
Beginning an IT project includes a fundamental skill of making the best product decision for your organization. One decision to make at the beginning of your project plan is to consider options available for your deliverable.
IT projects can be based on existing, off-the-shelf software that is customized to meet the needs of the project deliverables. In other cases, IT projects can be built from the ground up, in-house. Imagine you and your colleagues are consultants who have been asked to weigh in on the custom vs. off-the-shelf question at the beginning of an IT project at a Fortune 500 company.
Respond to the following in a minimum of 175 words:
In: Computer Science
#include <chrono.h> #include <stdlib.h> #include <iostream.h> #include<conio.h> #include <iomanip.h> //#include <string.h> #include <fstream.h> //using namespace std; int main(int argc, char * argv[]) { ifstream myfile; myfile.open("Input.txt"); auto st=high_resolution_clock::now(); float sum = 0; float a=0; //myfile >> a; int i=0; while (!myfile.eof()) { myfile >> a; sum+=a; } myfile.close(); auto stp=high_resolution_clock::now(); auto dur=duration_cast<microseconds>(stp-st); cout<<"Total time taken ="<<dur.count()<<"ms"<<endl;// displaying time taken cout<<"Sum of integers: "<<sum<<endl; // displaying results getch(); return 0; }
can someone please tell me what is wrong with this code. Its C++ programming
In: Computer Science
Use Python to solve: show all code:
2) For the last assignment you had to write a program that calculated and displayed the end of year balances in a savings account if $1,000 is put in the account at 6% interest for five years.
The program output looked like this:
Balance after year 1 is $ 1060.0
Balance after year 2 is $ 1123.6
Balance after year 3 is $ 1191.02
Balance after year 4 is $ 1262.48
Balance after year 5 is $ 1338.23
Modify your code so that it displays the balances for interest rates from three to five percent inclusive, in one percent intervals. (Hint: Use an outer loop that iterates on the interest rate, and an inner one that iterates on the year.)
Output:
Interest rate of 3 %:
Balance after year 1 is $ 1030.0
Balance after year 2 is $ 1060.9
Balance after year 3 is $ 1092.73
Balance after year 4 is $ 1125.51
Balance after year 5 is $ 1159.27
Interest rate of 4 %:
Balance after year 1 is $ 1040.0
Balance after year 2 is $ 1081.6
Balance after year 3 is $ 1124.86
Balance after year 4 is $ 1169.86
Balance after year 5 is $ 1216.65
Interest rate of 5 %:
Balance after year 1 is $ 1050.0
Balance after year 2 is $ 1102.5
Balance after year 3 is $ 1157.62
Balance after year 4 is $ 1215.51
Balance after year 5 is $ 1276.28
In: Computer Science
**only need part c and d answered below. It is in bold. In java, please implement the classes below. Each one needs to be created. Each class must be in separate file. The expected output is also in bold. I have also attached the driver for part 4.
2. The StudentRoster class should be in the assignment package.
a. There should be class variable for storing multiple students (the roster), semester and year. All class variables of the Student class must be private.
b. public StudentRoster(String semester, int year) is the single constructor of the class. All arguments of the constructor should be stored as class variables. There should no getters or setters for semester and year variables.
c. public boolean addStudent(String singleStudentData) takes a single student record as a string and breaks the string (tokenize) into first name, last name, grade1, grade2, grade3. The tokens are separated by comma. These values are used to create a Student object. If the student is already in the roster, then only the grades are updated (an additional student object is not added). If the student is not in the roster, then the Student object is added to the roster. The method returns true if a new student was added, return false otherwise.This method can generate two exceptions, BadGradeException and BadNameException. If first or last names are absent, or an integer is present where first and last names should be, then a BadNameException is generated. The message of this exception should state if it was caused by issues with first or last name. Similarly, a BadGradeException is generated if grades 1, 2 or 3 is absent or is not an integer. The message of this exception should state if it was caused by issues with grades 1, 2 or 3. The exceptions are not handled in this method.
d. public int addAllStudents(Scanner allStudents) takes a scanner object that contains multiple student records. Each student record is separated by a newline. This method must use theaddStudent method by retrieving one student record at a time from the Scanner object and passing that record to the addStudent method. The method returns the number of new students that were successfully added to the roster. This method handles all exceptions generated by the addStudent method. Before returning the count of successful additions to the roster, print to the console the total of each exception handled by the method.
The A4Driver class is attached below for guidance. I have also attached the expected output of the entire program.
package driver;
import java.util.Scanner;
import assignment.Student;
import assignment.StudentRoster;
public class A4Driver {
public static void main(String[] args) {
//test student class
System.out.println("test Student
class\n++++++++++++++++++++++++++++");
Student s = new Student("Bugs", "Bunny");
//same student
Student s3 = new Student("Bugs",
"Bunny");
System.out.println("Are students s
and s3 the same?: "+s.equals(s3)); //true
//not the same student
Student s2 = new Student("Buga",
"Bunny");
System.out.println("Are students s
and s2 the same?: "+s.equals(s2)); //false
//uncomment to check if
exception is thrown
s.equal(new Object());
//compute average 90
s.setGrade1(100);
s.setGrade2(90);
s.setGrade3(80);
System.out.println("Student s
average for the 3 grades is "+s.computeAverage());
System.out.println("\n\ntest
StudentRoster class\n++++++++++++++++++++++++++++");
String text =""
+ "Bugs, Bunny, 100 , 90, 80\n"
+ "Buga, Bunny, 100 , 80, 90\n"
+ "123, Bunny, 100 , 90, 80\n"
+ "Bugs, 1234 , 100 , 90, 80\n"
+ "BUGS, Bunny, 100 , 90, 80\n"
+ "Bugs, BUNNY, 100 , 90, 80\n"
+ "bugs, bunny, 70 , 90, 80\n"
+ "Betty, Davis, 100 , , \n"
+ "Betty, Davis, 100 , 40 , \n"
+ "Betty, Davis, , , \n"
+ "Betty, Davis, xx ,yy ,zz \n"
;
Scanner scan = new Scanner(text);
StudentRoster sr = new StudentRoster("Fall",
2019);
// Add only two students
System.out.println("\nTest addAllStudents, number of new students
added: "+sr.addAllStudents(scan));
//average of the two students should be 85
System.out.println("\nTest computeClassAverage, class
average is: "+sr.computeClassAverage());
//rank by grade1 Buga, Bugs
System.out.println("\nTest rankByGrade1:
"+sr.rankByGrade1());
//rank by grade2 Bugs, Buga
System.out.println("\nTest rankByGrade2:
"+sr.rankByGrade2());
//rank by grade3 Buga, Bugs
System.out.println("\nTest rankByGrade3:
"+sr.rankByGrade3());
//rank by average Buga, Bugs
System.out.println("\nTest rankByAverage:
"+sr.rankByAverage());
}
}
Example output:
__________Example from A4Driver shown below
test Student class ++++++++++++++++++++++++++++ Are students s and s3 the same?: true Are students s and s2 the same?: false Student s average for the 3 grades is 90.0
test StudentRoster class ++++++++++++++++++++++++++++ Exceptions Caught and Handled ========================== First name: 1
Last name: 1 Grade 1: 2 Grade 2: 1 Grade 3: 1
Test addAllStudents, number of new students added:
2
Test computeClassAverage, class average is: 85.0
Test rankByGrade1: [Buga Bunny grade1:100 grade2:80 grade3:90, Bugs
Bunny grade1:70 grade2:90 grade3:80]
Test rankByGrade2: [Bugs Bunny grade1:70 grade2:90 grade3:80, Buga Bunny grade1:100 grade2:80 grade3:90]
Test rankByGrade3: [Buga Bunny grade1:100 grade2:80 grade3:90, Bugs Bunny grade1:70 grade2:90 grade3:80]
Test rankByAverage: [Buga Bunny grade1:100 grade2:80 grade3:90, Bugs Bunny grade1:70 grade2:90 grade3:80]
In: Computer Science
Use Python to solve: show all work
1) Write a program that prints out a deck of cards, in the format specified below. (That is, the following should be the output of your code).
2 of hearts
2 of diamonds
2 of spades
2 of clubs
3 of hearts
3 of diamonds
3 of spades
3 of clubs
4 of hearts
4 of diamonds
4 of spades
4 of clubs
Continue with 5,6,7.. ending with
A of hearts
A of diamonds
A of spades
A of clubs
Start your program by defining the following two lists.
suits = ["hearts", "diamonds", "spades", "clubs"]
ranks = [“2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “J”, “Q”, “K”, “A”]
Remember you can use the for statement to get elements of a list.
For example if lst = ["A","B","C"] then
for elem in lst:
print (elem)
would print
A
B
C
In: Computer Science
java binary heap operation counts
/*
* Add operation counts to all methods - 4pts
* No other methods/variables should be added/modified
*/
public class A6BH <E extends Comparable<? super E>>
{
private int defaultSize = 4;
private int count = 0;
private E[] heap;
private int opCount = 0;
public int getOpCount()
{
return opCount;
}
public void resetOpCount()
{
opCount = 0;
}
public A6BH()
{
heap = (E[])new
Comparable[defaultSize];
}
public A6BH(int size)
{
heap = (E[])new
Comparable[this.nextSize(size)];
}
public A6BH(E[] items)
{
heap = (E[])new
Comparable[this.nextSize(items.length)];
this.addAll(items);
}
public void addAll(E[] items)
{
//make sure there is room for all
new items
if(count+items.length >=
heap.length)
{
growArray(this.nextSize(count+items.length));
}
for(E item : items)//copy new
items in order
{
count++;
heap[count] =
item;
}
this.buildHeap();//fix heap
order
}
private void buildHeap()
{
for(int i = count >> 1; i
> 0; i--)
{
percolateDown(i);
}
}
public void insert(E val)
{
//make sure we have room for new
item
if(count+1 >= heap.length)
{
growArray();
}
count++;
heap[0] = val;//temporary
storage
percolateUp(count);
}
private void percolateUp(int pos)
{
//pos>>1 = pos/2 - getting to
parent of empty space
for(;heap[pos>>1].compareTo(heap[0]) > 0;pos =
pos>>1)
{
heap[pos] =
heap[pos>>1];//move parent down a level
}
heap[pos] = heap[0];//take value
from initial insert and put in correct pos
}
public E findMin()
{
return (count >
0)?heap[1]:null;
}
public E deleteMin()
{
if(count > 0)
{
E temp =
heap[1];
heap[1] =
heap[count];//moved last value to top
count--;//decrease size
percolateDown(1);//move top value down to final position
return
temp;
}
else
{
return null;//no
items in heap
}
}
private void percolateDown(int pos)
{
int firstChild = pos <<
1;//pos * 2
E temp = heap[pos];
for(;pos<<1 <= count; pos
= firstChild, firstChild = pos<<1)
{
if(firstChild+1
<= count)//there is a second child
{
if(heap[firstChild].compareTo(heap[firstChild+1]) > 0)
{
firstChild++;
}
}
//firstChild is
now the index of the smaller child
if(temp.compareTo(heap[firstChild]) > 0)
{
heap[pos] = heap[firstChild];//move child up to
parent and continue
}
else
{
break;//stop loop because we found correct
position for temp
}
}
heap[pos] = temp;
}
public String toString()
{
String output = "Heap
Size:"+heap.length+"\n";
for(int i = 1; i <= count;
i++)
{
output +=
heap[i]+",";
}
return output;
}
public boolean isEmpty()
{
return count == 0;
}
public void makeEmpty()
{
count = 0;
}
private void growArray()//O(N)
{
growArray(heap.length <<
1);//heap.length * 2
}
private void growArray(int size)
{
//new array that is twice as
big
E[] newArr = (E[])new
Comparable[size];
//Move values to new array
for(int i = 1; i <= count;
i++)//O(N)
{
newArr[i] =
heap[i];
}
//System.out.println(Arrays.toString(newArr));
heap = newArr;//replace small array
with new one
}
private int nextSize(int size)
{
return 1 <<
(Integer.toBinaryString(size).length() + 1);//2^(number of bits to
represent number)
}
}
======================================================================================================
import java.util.Arrays;
import java.util.Random;
public class A6Driver {
public static void main(String[] args) {
Random randGen = new
Random();
randGen.nextInt(10);//better timing
values
long time =
System.nanoTime();//better timing values
A6BH<Integer> heap = new
A6BH<>();
heap.insert(5);//better timing
values
int testCases = 7;
for(int i = 1; i <= testCases;
i++)
{
System.out.println("Test "+i);
int N =
(int)Math.pow(10, i);
Integer[]
randoms = new Integer[N];
time =
System.nanoTime();
for(int j = 0; j
< randoms.length; j++)
{
randoms[j] = randGen.nextInt(N)+1;
}
time =
System.nanoTime() - time;
System.out.println("Generate "+N+" Randoms: "+(time/1000000000.0)+
" seconds");
time =
System.nanoTime();
heap = new
A6BH<>(randoms);
time =
System.nanoTime() - time;
System.out.println("Bulk insert: " + (time/1000000000.0)+"
seconds");
System.out.println("Bulk insert: " + heap.getOpCount()+"
operations");
time =
System.nanoTime();
heap = new
A6BH<>();
for(int j = 0; j
< randoms.length; j++)
{
heap.insert(randoms[j]);
}
time =
System.nanoTime() - time;
System.out.println("Individual insert: " + (time/1000000000.0)+"
seconds");
System.out.println("Individual insert: " + heap.getOpCount()+"
operations");
System.out.println();
}
}
}
In: Computer Science
DNS Query and Web Page Access Time:
Suppose you click on a hyperlink on a webpage you are currently viewing -- this causes a new web page to be loaded and displayed. Suppose the IP address for the host in the new URL is not cached in your local DNS server (AKA local name server), so your Client (browser) makes a DNS query to obtain the IP address before the page can be requested from the web server.
To resolve the DNS (obtain the IP Address for the web server), three separate DNS servers are queried (local DNS Name Server, TLD1 and Authoritative NS). Finally, the local name server returns the IP address of the web server to the Client and the DNS is resolved. The round trip times (RTT) to reach the DNS servers are: RTT0 = 3 msec, RTT1 =40 msec and RTT2 = 20 msec.
The requested Web page contains a base HTML page and no objects. RTTHTTP = 60msec is the time to send an HTTP request to the Web Server hosting the webpage and receive a response is. In other words, it takes 60msecs for the Client to fetch a web page/object from the web server. (Note: RTT = Round Trip Time = the time to send request and receive a response – inclusive, both directions).
Authoritative NS TLD1
With respect to the above information, answer the following questions:
A. DNS
a. Make a list describing in words (not numbers) each step in the DNS resolution:
What does the Client have at the end of this query?
Local Name Server
b. How much time in total is spent on the DNS query (show your numbers)?
B. Accessing the Web Page
c. Now that the client has the IP address of the web server, what
step must the Client do before
sending the HTTP request? How long does this step take?
How long does it take to retrieve the base web page from the web server? (include step c)
How much total time IN TOTAL elapses from the instant the client first clicks on the hyperlink until the web page is displayed? This time includes (b),(c) and (d). (Assume 0 seconds transmission time for the web page – makes the problem easier, but not really true for large files!)
C. New Page / New Objects
Now suppose you request another page on the same web server: a base HTML page and 4 small objects. Neglecting transmission time, how much time elapses from the instant the new link is clicked until the entire page can be displayed? Assume the local DNS server has cached the IP address of the web server. Show your work. Assume persistent connection and pipelining.
In: Computer Science
For this assignment, you will modify existing code to create a single Java™ program named BicycleDemo.java that incorporates the following:
Read through the "Lesson: Object-Oriented Programming Concepts" on The Java™ Tutorials website.
Download the linked Bicycle class, or cut-and-paste it at the top of a new Java™ project named BicycleDemo.
Download the linked BicycleDemo class, or cut-and-paste it beneath the Bicycle class in the BicycleDemo.java file.
Optionally, review this week's Individual "Week One Analyze Assignment," to refresh your understanding of how to code derived classes.
Adapt the Bicycle class by cutting and pasting the class into the NetBeans editor and completing the following:
Using the NetBeans editor, adapt the BicycleDemo class as follows:
Comment each line of code you add to explain what you added and why. Be sure to include a header comment that includes the name of the program, your name, PRG/421, and the date.
Rename your JAVA file to have a .txt file extension.
Submit your TXT file.
*******************CODE**************************
class Bicycle { int cadence = 0; int speed = 0; int gear = 1; void changeCadence(int newValue) { cadence = newValue; } void changeGear(int newValue) { gear = newValue; } void speedUp(int increment) { speed = speed + increment; } void applyBrakes(int decrement) { speed = speed - decrement; } void printStates() { System.out.println("cadence:" + cadence + " speed:" + speed + " gear:" + gear); } }
***********************************SECOND CLASS********************************************
class BicycleDemo { public static void main(String[] args) { // Create two different // Bicycle objects Bicycle bike1 = new Bicycle(); Bicycle bike2 = new Bicycle(); // Invoke methods on // those objects bike1.changeCadence(50); bike1.speedUp(10); bike1.changeGear(2); bike1.printStates(); bike2.changeCadence(50); bike2.speedUp(10); bike2.changeGear(2); bike2.changeCadence(40); bike2.speedUp(10); bike2.changeGear(3); bike2.printStates(); } }
In: Computer Science
The purpose of creating an abstract class is to model an abstract situation.
Example:
You work for a company that has different types of customers: domestic, international, business partners, individuals, and so on. It well may be useful for you to "abstract out" all the information that is common to all of your customers, such as name, customer number, order history, etc., but also keep track of the information that is specific to different classes of customer. For example, you may want to keep track of additional information for international customers so that you can handle exchange rates and customs-related activities, or you may want to keep track of additional tax-, company-, and department-related information for business customers.
Modeling all these customers as one abstract class ("Customer") from which many specialized customer classes derive or inherit ("InternationalCustomer," "BusinessCustomer," etc.) will allow you to define all of that information your customers have in common and put it in the "Customer" class, and when you derive your specialized customer classes from the abstract Customer class you will be able to reuse all of those abstract data/methods.This approach reduces the coding you have to do which, in turn, reduces the probability of errors you will make. It also allows you, as a programmer, to reduce the cost of producing and maintaining the program.
In this assignment, you will analyze Java™ code that declares one abstract class and derives three concrete classes from that one abstract class. You will read through the code and predict the output of the program.
Read through the linked Java™ code carefully.
Predict the result of running the Java™ code. Write your prediction into a Microsoft® Word document, focusing specifically on what text you think will appear on the console after running the Java™ code.
In the same Word document, answer the following question:
CODE:
/**********************************************************************
* Program: PRG/421 Week 1 Analyze Assignment
* Purpose: Analyze the coding for an abstract class
* and two derived classes, including overriding methods
* Programmer: Iam A. Student
* Class: PRG/421r13, Java Programming II
* Instructor:
* Creation Date: December 13, 2017
*
* Comments:
* Notice that in the abstract Animal class shown here, one method is
* concrete (the one that returns an animal's name) because all animals can
* be presumed to have a name. But one method, makeSound(), is declared as
* abstract, because each concrete animal must define/override the makeSound() method
* for itself--there is no generic sound that all animals make.
**********************************************************************/
package mytest;
// Animal is an abstract class because "animal" is conceptual
// for our purposes. We can't declare an instance of the Animal class,
// but we will be able to declare an instance of any concrete class
// that derives from the Animal class.
abstract class Animal {
// All animals have a name, so store that info here in the superclass.
// And make it private so that other programmers have to use the
// getter method to access the name of an animal.
private final String animalName;
// One-argument constructor requires a name.
public Animal(String aName) {
animalName = aName;
}
// Return the name of the animal when requested to do so via this
// getter method, getName().
public String getName() {
return animalName;
}
// Declare the makeSound() method abstract, as we have no way of knowing
// what sound a generic animal would make (in other words, this
// method MUST be defined differently for each type of animal,
// so we will not define it here--we will just declare a placeholder
// method in the animal superclass so that every class that derives from
// this superclass will need to provide an override method
// for makeSound()).
public abstract String makeSound();
};
// Create a concrete subclass named "Dog" that inherits from Animal.
// Because Dog is a concrete class, we can instantiate it.
class Dog extends Animal {
// This constructor passes the name of the dog to
// the Animal superclass to deal with.
public Dog(String nameOfDog) {
super(nameOfDog);
}
// This method is Dog-specific.
@Override
public String makeSound() {
return ("Woof");
}
}
// Create a concrete subclass named "Cat" that inherits from Animal.
// Because Cat is a concrete class, we can instantiate it.
class Cat extends Animal {
// This constructor passes the name of the cat on to the Animal
// superclass to deal with.
public Cat(String nameOfCat) {
super(nameOfCat);
}
// This method is Cat-specific.
@Override
public String makeSound() {
return ("Meow");
}
}
class Bird extends Animal {
// This constructor passes the name of the bird on to the Animal
// superclass to deal with.
public Bird (String nameOfBird) {
super(nameOfBird);
}
// This method is Bird-specific.
@Override
public String makeSound() {
return ("Squawk");
}
}
public class MyTest {
public static void main(String[] args) {
// Create an instance of the Dog class, passing it the name "Spot."
// The variable aDog that we create is of type Animal.
Animal aDog = new Dog("Spot");
// Create an instance of the Cat class, passing it the name "Fluffy."
// The variable aCat that we create is of type Animal.
Animal aCat = new Cat("Fluffy");
// Create an instance of (instantiate) the Bird class.
Animal aBird = new Bird("Tweety");
//Exercise two different methods of the aDog instance:
// 1) getName() (which was defined in the abstract Animal class)
// 2) makeSound() (which was defined in the concrete Dog class)
System.out.println("The dog named " + aDog.getName() + " will make this sound: " + aDog.makeSound());
//Exercise two different methods of the aCat instance:
// 1) getName() (which was defined in the abstract Animal class)
// 2) makeSound() (which was defined in the concrete Cat class)
System.out.println("The cat named " + aCat.getName() + " will make this sound: " + aCat.makeSound());
System.out.println("The bird named " + aBird.getName() + " will make this sound: " + aBird.makeSound());
}
}
In: Computer Science
How to print output vertically in the code attached below:
import operator with open ('The Boy .txt',encoding='utf8') as my_file: contents=my_file.read() l = contents.strip() words = l.split() newdict = dict() for i in words: if i in newdict: newdict[i] = newdict[i] + 1 else: newdict[i] = 1 newly = dict() sorted_Dict = sorted(newdict.items(), key=operator.itemgetter(1), reverse=True) for n in sorted_Dict: newly[n[0]] = n[1] print(newly) with open('freqs.txt','w', encoding='utf8') as final: final.write(str(newly))
In: Computer Science
using c language:
Add two vectors of doubles. Name this function vect_add(). Subtract two vectors of doubles. Name this function vect_sub(). Multiplies element by element two vectors. Name this function vect_prod(). Compute and return the dot product of two vectors. Name this function vect_dot_prod(). The dot product operation is the result of taking two vectors(single dimension arrays) and multiplying corresponding element by element and then adding up the sum of all the products. For example, if I have 2 vectors of length 3 that have the following values {l, 2, 3} and {3, 2, l} the dot product of these two vectors is: 1*3+2*2+3*1 = 10 Compute and return the mean of a single vector. Name this function vect_mean(). Compute and return the median of a single vector. Name this function vect_median(). First sort the array. If the length of the sorted array is odd, then the median is the middle element. If the length is odd, the median is the average of the middle two elements. Compute and return the maximum element of a vector. Name this function vect_max(). Compute and return the minimum element of a vector. Name this function vect_min(). Write a function that reverses the elements in a given array. This function will change the original array, passed by reference. Name this function vect_reverse().
In: Computer Science
For this class exercise, each group will be assigned the file with the exercise number that corresponds to their group. The group will analyze the code to determine what the code does, how the data is structured, and why it is the appropriate data structure. Note that these are various examples, some are partial code with just classes and methods and do not include the "main" or "test" code needed to execute. Each team will add a header describing the purpose of the program (each class and method), comments to the code, and walkthrough the code with the class, answering questions as the instructor. IF the code is executable, then your group will demonstrate the code. Submit your file with the commented code. Make sure to include the names of everyone in your group on the file.
.......................................................................................................................................................................................................................................................................................
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Random;
public class ListTest3 {
public static void main(String[] args) {
LinkedList<Integer> list = new LinkedList<Integer>();
int newNumber;
Random randomNumber = new Random();
for (int k = 0; k <25; k++) {
newNumber = randomNumber.nextInt(101);
list.add(newNumber);
}
Collections.sort(list);
System.out.println(list);
int count = 0;
Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()) {
count += iterator.next();
}
System.out.printf("Sum is: %d%nAverage is: %.2f", count,
((double) count / list.size()));
}
}
In: Computer Science
In: Computer Science