The expected output as given in Figure 2: Postageliammeny bt - Netepae File Edt Format View Hele Monthly Sunnary 1) The total weight of all iten is 22.7kg 2) The total price of all iten is 128.52 3) The most heaviest iten details: Postcode: 200e Weight: 12.8kg Content type: cloth Postage fee: R67.99 c) Close all file streams in used. d) Apply exception handling mechanism in the program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

here solution for part a pls give solution for part b, c, d

import java.io.*;
public class CopyFile {

   public static void main(String args[]) throws IOException {  
      FileInputStream in = null;
      FileOutputStream out = null;

      try {
         in = new FileInputStream("input.txt");
         out = new FileOutputStream("output.txt");
         
         int c;
         while ((c = in.read()) != -1) {
            out.write(c);
         }
      }finally {
         if (in != null) {
            in.close();
         }
         if (out != null) {
            out.close();
         }
      }
   }

The expected output as given in Figure 2:
Postagelummeny bet - Netepad
File Edt Format View Help
Monthly Sunnary
1) The total weight of all iten is 22.7kg
2) The total price of all iten is 128.52
3) The most heaviest iten details:
Postcode: 20000
Weight: 12.8kg
Content type: cloth
Postage fee: RN67.99
c) Close all file streams in used.
d) Apply exception handling mechanism in the program
Transcribed Image Text:The expected output as given in Figure 2: Postagelummeny bet - Netepad File Edt Format View Help Monthly Sunnary 1) The total weight of all iten is 22.7kg 2) The total price of all iten is 128.52 3) The most heaviest iten details: Postcode: 20000 Weight: 12.8kg Content type: cloth Postage fee: RN67.99 c) Close all file streams in used. d) Apply exception handling mechanism in the program
Given the following text file named Posini.txt in Figure 1 that contains posting data of a courier company Posini. The data is comprised of postcode, weight (kg), content type and postage fee.
Posini.bt - Notepad
File Edit Format View Help
20000; 12.8;cloth;67.99
21100; 3.1;glass; 23.45
40008;2.5; document;17.09
45678;4.3; device;19.99
Winde Ln 1, ( 100%
Write a complete Java program using File /O operation that can perform the following tasks:
a) Read all records from text file named Posini.txt in Figure 1
b) Analyze and write the following information to a text file named PostageSummary.txt
• Total weight of all item
Total price of all item
• The most heaviest item details
Transcribed Image Text:Given the following text file named Posini.txt in Figure 1 that contains posting data of a courier company Posini. The data is comprised of postcode, weight (kg), content type and postage fee. Posini.bt - Notepad File Edit Format View Help 20000; 12.8;cloth;67.99 21100; 3.1;glass; 23.45 40008;2.5; document;17.09 45678;4.3; device;19.99 Winde Ln 1, ( 100% Write a complete Java program using File /O operation that can perform the following tasks: a) Read all records from text file named Posini.txt in Figure 1 b) Analyze and write the following information to a text file named PostageSummary.txt • Total weight of all item Total price of all item • The most heaviest item details
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education