Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-20
3
Medium Priority
?
232 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
1 Comment
 
LVL 35

Accepted Solution

by:
girionis earned 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

824 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