Solved

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

Posted on 2003-11-20
3
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

710 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