Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySqlDump not dumping triggers 1 52
jsp login check 12 52
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 26
JDBC performance 8 28
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 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…

679 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