Solved

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

Posted on 2003-11-20
3
223 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now