Solved

InventoryControl program in which InventorySold and UseInventorySold inherit parts of the InventoryControl

Posted on 2003-11-20
3
225 Views
Last Modified: 2010-05-18
import javax.swing.*;

public class DialogInitials
{
_public static void main(String[]args)
_{
__int teaCalculate;

__String teaName = JOptionPane.showInputDialog(null,"Please enter the name of the tea:");
__//JOptionPane.showMessageDialog(null,response);

__String teaNumber = JOptionPane.showInputDialog(null,"Please enter the number of boxes on hand:");

__try
___{
____int value = Integer.parseInt(teaNumber);
___}

__catch(NumberFormatException e)
___{
____JOptionPane.showMessageDialog(null,"Invalid entry");
____System.exit(1);
___}

__String teaUsed = JOptionPane.showInputDialog(null,"Please enter the number of boxes used:");

__try
_____{
______int value = Integer.parseInt(teaUsed);
_____}

____catch(NumberFormatException e)
_____{
______JOptionPane.showMessageDialog(null,"Invalid entry");
______System.exit(1);
_____}

_____int x=Integer.parseInt(teaNumber);
_____int y=Integer.parseInt(teaUsed);

_____teaCalculate= x-y;





__System.out.println("The Tea is " + teaName);
__System.out.println("The number of boxes on hand " + teaNumber);
__System.out.println("The number of boxes used " + teaUsed);
__//JOptionPane.showConfirmDialog(null,"Are the initials correct?");
__System.out.println("The number of boxes left is " + teaCalculate);
__System.exit(0);
_}
}

I am writing a inventory program to keep track track of the tea i serve to my customer.The program will allow me to enter the name of tea,the number of boxes on hand, and the number of boxes remaining. I have the first functioning program call DialogInitial(InventoryControl), I need to use inheritance between these three program{InventoryControl,InventorySold, and UseInventorySold} How should i write the other two programs to inherit information from the first program,then second, and third program????
0
Comment
Question by:Aminhall
3 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 500 total points
ID: 9795396
 Inheritance is done through extending a class. So if you want to inherit from class A in a class B you just do a

public class B extends A

  same for other subclasses

public class C extends B

(class C inherits from both B and A).
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 80
Java Timer (static) 9 43
servlet example 11 40
CSV file parsing thru Java 13 28
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question