ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 09 May 2017 My Price 9.00

import java.io.BufferedWriter

I need help with this program. It is not working like it shows in the instructions, nor do I know how to fix it or what the psuedocode is. 

 

import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.util.Scanner;/*** @author**/public class inventoryNeeded {/*** @param args*/public static void main(String[] args) {Scanner scanner = null;try {scanner = new Scanner(new File("inventory.txt"));File file = new File("inventoryNeeded.txt");// if file doesnt exists, then create itif (!file.exists()) {file.createNewFile();}FileWriter fw = new FileWriter(file.getAbsoluteFile());BufferedWriter bw = new BufferedWriter(fw);while (scanner.hasNext()) {String partNumber = scanner.next();int quantity = scanner.nextInt();int sales = scanner.nextInt();int reqSale = scanner.nextInt();bw.write("Part Number:" + partNumber + "\n");bw.write("Current Balance:" + (quantity - sales) + "\n");bw.write("Amount Needed:" + (reqSale - (quantity - sales))+ "\n\n");}System.out.println("Inventory written successfully toinventoryNeeded.txt");bw.close();} catch (IOException e) {// TODO: handle exception} finally {if (scanner != null)scanner.close();}}}inventory.txtQA310954750CM145320162200

Afer reading the chapters in this module, students will design the logic For an applicaTon and submit aparTally completed Java program.±he BMC Parts Company needs a program that will read the inventory.txt ²le and create an inventoryreport based on the data in the ²le. ±he inventory.txt ²le contains the part number, opening balance,number oF items sold, and the minimum stock required.±he output ²le, inventoryNeeded.txt, willcontain the part number, current balance and the amount that is necessary to bring the inventory to theminimum level.In this assignment, students will design the logic For the program that reads the input ²le and creates theoutput ²le. ³iles provided include inventory.txt and the parTally completed programinventoryNeeded.java.±he program ²le provided includes the necessary variable declaraTons and inputand output ²le statements. You need to write the part oF the program that reads the input ²le, calculatesthe current balance and amount required to bring the inventory to the minimum level.±hen output thepart number, current balance and the amount needed to the output ²le.In this assignment, students will submit both the .java and the .class ²les For the completed programalong with the output ²le created From the program execuTon, and the pseudocode.±he ²les will besubmi´ed by the posted due date using the appropriate dropbox.±he pseudocode must be submi´ed as a Microsof Word compaTble ²le. Examples oF Word compaTbledocuments are those with a .doc, .docx, or .rµ ²le extension. IF there is a quesTon about the Format,consult with your instructor beFore submi¶ng your assignment.inventory.txt ²le contains:

Attachments:

Answers

(11)
Status NEW Posted 09 May 2017 12:05 AM My Price 9.00

inv-----------ent-----------ory-----------Nee-----------ded-----------

Attachments

1498630407-inventoryNeeded.zip
(1)