Java Articles

Submit Article
Home » Articles » Java » File HandlingRSS Feeds

Program of inventory management and demonstrating interactive input and output

Posted By: Easy Tutor     Category: Java     Views: 26530

Write a program of inventory management and demonstrating interactive input and output.

Code for Program of inventory management and demonstrating interactive input and output in Java

import java.io.*;
import java.util.*;

class  Inventory
    static DataInputStream din = new DataInputStream(System.in);
    static StringTokenizer st;
    publicstaticvoid main(String[] args) throws IOException
           DataOutputStream dos = new DataOutputStream(
                          new    FileOutputStream("Invent.txt"));

           //Reading from the console
           System.out.print("Enter code number : ");
           st = new StringTokenizer(din.readLine());
           int code = Integer.parseInt(st.nextToken());

           System.out.print("Enter Item : ");
           st =new StringTokenizer(din.readLine());
           int item = Integer.parseInt(st.nextToken());

           System.out.print("Enter Cost of Item : ");
           st =new StringTokenizer(din.readLine());
           double cost = new Double(st.nextToken()).doubleValue();

           //Writing to the file Invent.txt
           //processing data from the file
           DataInputStream dis = new DataInputStream( new 
           int codeNumber = dis.readInt();
           int  totalItems = dis.readInt();
           double itemCost = dis.readDouble();
           double totalCost = totalItems * itemCost;

           //Writing to Console
           System.out.println("\nCode Number : " + codeNumber);
           System.out.println("Item cost          : " + itemCost);
           System.out.println("Total Items       : " + totalItems);
           System.out.println("Total Cost         : " + totalCost);

Easy Tutor
Easy Tutor author of Program of inventory management and demonstrating interactive input and output is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Happy Programming :)

View All Articles

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!