Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE LINKEDLIST (no library) 1. Class Invoice ( the node ) that includes three instance variables: int No; // the Invoice No String CustName; //

USE LINKEDLIST (no library)

1. Class Invoice ( the node ) that includes three instance variables:

int No; // the Invoice No

String CustName; // the Customer name

int Amount; // the Invoice Amount

Invoice next; // points to the next Invoice

Default and overloaded constructors

2. Class Shop that includes two instance variables:

Invoice head;

Invoice Tail;

Your class should have the following:

A method that initializes the instance variables.

void add (int, String, int) creates and adds the Invoice information ( No, CustName and Amount) in the singly linked list.

void delete (int) to delete an Invoice in the single linked list.

void printInvoices() prints all the Invoices in the single linked list.

int countInvoices () counts the number of Invoices in the list.

int Sum () counts the summation of the Invoices amounts.

Write a test application. In the main method, do the following:

Create a Shop object.

Ask the user to enter the number of Invoices in the Shop.

Input the No, CustName and Amount of each Invoice and add it to the Shop class (Hint: Use a loop).

Print the Invoices.

Input the No. of the Invoice to be deleted. Delete the Invoice.

Print the Invoices.

Print the number of Invoice.

Print the summation of all Invoices amounts.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

2. Discuss various aspects of the training design process.

Answered: 1 week ago

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago