APlusGrades

Not Rated (0)

$15/per page/Negotiable

About APlusGrades

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

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing,Foreign Languages,Geography,Geology,Health & Medical,HR Management,Law,Management,Physics,Programming,Science,Statistics Hide all
Teaching Since: Jul 2017
Last Sign in: 364 Weeks Ago, 1 Day Ago
Questions Answered: 1850
Tutorials Posted: 1850

Education

  • Graduate in Biology and Nutrition, MBA Finance
    Florida State University
    Aug-2000 - Jul-2007

Experience

  • Ass. Relationship Manager
    Penn-Florida
    Mar-2009 - Feb-2016

Category > Computer Science Posted 20 Jul 2017 My Price 12.00

import import import import import java.BufferedWriter; java.File; java.FileWriter; java.IOException; java.Scanner; /** * @author * */ public class...

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 it

           if (!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 to inventoryNeeded.txt");

           bw.close();

 

       } catch (IOException e) {

           // TODO: handle exception

       } finally {

           if (scanner != null)

               scanner.close();

       }

   }

}

 

inventory.txt

QA310

95

47

50

CM145

320

162

200

MS514

34

20

25

EN212

163

150

 

160

 

Attachments:

Answers

Not Rated (0)
Status NEW Posted 20 Jul 2017 04:07 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â-----------  -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I

Not Rated(0)