
Explanation of Solution
Modified program:
//import the required header files
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
//definition of "Total" class
public class Total
{
//definition of main method
public static void main(String args[]) throws FileNotFoundException
{
//declare an object for "Scanner" class
Scanner console = new Scanner(System.in);
//get the input file name
System.out.println("Input file:");
String inputFileName = console.next();
//get the output file name
System.out.println("Output file:");
String outputFileName = console.next();
//declare a variable for "File" class
File inputFile = new File(inputFileName);
//declare an object for "Scanner" class
Scanner in = new Scanner(inputFile);
//declare an object for "PrintWriter" class
PrintWriter out = new PrintWriter(outputFileName);
//declare the required variables
double total = 0;
int count = 0;
//check the condition
while(in.hasNextDouble())
{
//get the number from the user
double value = in...

Want to see the full answer?
Check out a sample textbook solution
Chapter 7 Solutions
Big Java Late Objects
- What happens to MAC addresses as frames travel from one node (device) to another? What happens to MAC addresses as frames travel from one network to another? What happens to IP addresses as packets travel from one node (device) to another? What happens to IP addresses as packets travel from one network to another?arrow_forwardCan you check if my explation is correct: Challenge: Assume that the assigned network addresses are correct. Can you deduce (guess) what the network subnet masks are? Explain while providing subnet mask bits for each subnet mask. [Hint: Look at the addresses in binary and consider the host ids] To assume that the network addresses are correct, we take a look at the network ID and IP addresses. Take 20.0.0.0/8, we have an /8 prefix which is Class A, that provide us with 255.0.0.0. This means that there are 24 host bits while the network bits are 8. When compared to the IP address 20.255.0.7, we can perform an additional operation with the subnet mask giving us 20.0.0.0. The same happened with 20.0.0.89, which we also got 20.0.0.0. Therefore, these two IP addresses fall within the respective /8 subnet. For 200.100.10.0/30, the /30 is Class C with a subnet mask of 255.255.255.252, meaning 30 network bits and only two host bits. When applying the subnet mask and the IP addresses…arrow_forwardIt is possible to sort an array of n values using pipeline of n filter processes.The first process inputs all the values one at a time, keep the minimum, and passes the others on to the next process. Each filter does the same thing; it receives a stream of values from the previous process, keep the smallest, and passes the others to the next process. Assume each process has local storage for only two values--- the next input value and the minimum it has seen so far. (a) Developcode for filter processes. Declare the channels and use asynchronous message passing. Hint:Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 ton-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channelvalue[i], keeps the smallest, and sends all other integers to channel value[i+1]. The last processFilter[n-1] receives only one integer through channel value[n-1] and does not need to send anyinteger further.arrow_forward
- It is possible to sort an array of n values using pipeline of n filter processes.The first process inputs all the values one at a time, keep the minimum, and passes the others on to the next process. Each filter does the same thing; it receives a stream of values from the previous process, keep the smallest, and passes the others to the next process. Assume each process has local storage for only two values--- the next input value and the minimum it has seen so far. (a) Developcode for filter processes. Declare the channels and use asynchronous message passing. Hint:Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 ton-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channelvalue[i], keeps the smallest, and sends all other integers to channel value[i+1]. The last processFilter[n-1] receives only one integer through channel value[n-1] and does not need to send anyinteger further.arrow_forwardIt is possible to sort an array of n values using pipeline of n filter processes.The first process inputs all the values one at a time, keep the minimum, and passes the others on to the next process. Each filter does the same thing; it receives a stream of values from the previous process, keep the smallest, and passes the others to the next process. Assume each process has local storage for only two values--- the next input value and the minimum it has seen so far. (a) Developcode for filter processes. Declare the channels and use asynchronous message passing. Hint:Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 ton-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channelvalue[i], keeps the smallest, and sends all other integers to channel value[i+1]. The last processFilter[n-1] receives only one integer through channel value[n-1] and does not need to send anyinteger further.arrow_forwardIt is possible to sort an array of n values using pipeline of n filter processes.The first process inputs all the values one at a time, keep the minimum, and passes the others on to the next process. Each filter does the same thing; it receives a stream of values from the previous process, keep the smallest, and passes the others to the next process. Assume each process has local storage for only two values--- the next input value and the minimum it has seen so far. (a) Developcode for filter processes. Declare the channels and use asynchronous message passing. Hint:Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 ton-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channelvalue[i], keeps the smallest, and sends all other integers to channel value[i+1]. The last processFilter[n-1] receives only one integer through channel value[n-1] and does not need to send anyinteger further.arrow_forward
- It is possible to sort an array of n values using pipeline of n filter processes.The first process inputs all the values one at a time, keep the minimum, and passes the others on to the next process. Each filter does the same thing; it receives a stream of values from the previous process, keep the smallest, and passes the others to the next process. Assume each process has local storage for only two values--- the next input value and the minimum it has seen so far. (a) Developcode for filter processes. Declare the channels and use asynchronous message passing. Hint:Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 ton-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channelvalue[i], keeps the smallest, and sends all other integers to channel value[i+1]. The last processFilter[n-1] receives only one integer through channel value[n-1] and does not need to send anyinteger further.arrow_forwardI need help: Challenge: Assume that the assigned network addresses are correct. Can you deduce (guess) what the network subnet masks are? Explain while providing subnet mask bits for each subnet mask. [Hint: Look at the addresses in binary and consider the host ids]arrow_forwardI would like to know if my answer statment is correct? My answer: The main difference is how routes are created and maintained across different networks. Static routing establishes router connections to different networks from the far left and far right. The Dynamic routing focus emphasizes immediate connection within the router while ignoring the other connections from different networks. Furthermore, the static routing uses the subnet mask to define networks such as 25.0.0.0/8, 129.60.0.0/16, and 200.100.10.0/30, which correspond to 255.0.0.0, 255.255.0.0, and 255.255.255.252. On the other hand, dynamic routing uses the wildcard mask to inverse the subnet mask, where network bits become 0 and host bits become 1, giving us 0.0.0.255, 0.0.255.255, and 0.0.0.3. Most importantly, the CLI commands used for Static and Dynamic routing are also different. For static routing, the “IP route” corresponds with the network, subnet mask, and next-hop IP address. In contrast, dynamic routing uses…arrow_forward
- 1. [30 pts] Match the items on the left with the memory segment in which they are stored. Answers may be used more than once, and more than one answer may be required. 1. Static variables 2. Local variables 3. Global variables 4. Constants 5. Machine Instructions 6. malloc() 7. String Literals Answer A. Code B. Static C. Heap D. Stackarrow_forwardBuild an Android App that shows a list of your favorite books' details. The App should have a set of java files that implement an adapter with RecyclerView. The details of the java files you need to create are described below. RecycleViewExample RHONDA BYRNE 2016 Listen to Your Heart: The London Adventure Ruskin Bond 2010 Business of Sports: The Winning Formula for Success Vinit Karnik 2022 A Place Called Home Preeti Shenoy 2018 Vahana Masterclass Alfredo Covelli 2016 The Little Book of Encouragement Dalai Lama 2021 Platform Scale: For A Post-Pandemic World Sangeet Paul Choudary 2021 Unfinished Priyanka Chopra Jonas 2018 1. The first java file should contain a data field which is in this case: Book_name, Author_name, Publication_year. 2. The second java file contains BookViewHolder. 3. The third java file contains the BookAdapter which is act as a bridge between the data items and the View inside of RecycleView. 4. The Mainactivity java file will contain some samples data to display.…arrow_forwardmodule : java Question3: (30 MARKS) Passenger Rail Agency for South Africa Train Scheduling System Problem Statement Design and implement a train scheduling system for Prasa railway network. The system should handle the following functionalities: 1. Scheduling trains: Allow the addition of train schedules, ensuring that no two trains use the same platform at the same time at any station. 2. Dynamic updates: Enable adding new train schedules and canceling existing ones. 3. Real-time simulation: Use multithreading to simulate the operation of trains (e.g., arriving, departing). 4. Data management: Use ArrayList to manage train schedules and platform assignments. Requirements 1. Add Train Schedule, Cancel Scheduled Train, View Train Schedules and Platform Management 2. Concurrency Handling with Multithreading i.e Use threads to simulate train operations, Each…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





