WRITE THE OUTPUT OF THE PROGRAM AND WRITE THE UML DIAGRAM OF THE PROGRAM : JAVA

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question
100%

WRITE THE OUTPUT OF THE PROGRAM AND WRITE THE UML DIAGRAM OF THE PROGRAM :

JAVA

public class TestMain {

public static void main(String[] args) {

Invoice check1= new Invoice(112, "Book", 3, 125.98);

Invoice check2= new Invoice(101, "Phone", 2, 456.35);

Invoice check3= new Invoice(187, "Laptop", 1, 2345.68);

check1.displayLine();

check2.displayLine();

check3.displayLine();

}

}

class Invoice {

private int item_number;

private String name;

private int quantity;

private double price;

private double total_cost;

public Invoice(int item_num, String nm, int quan, double pri)

{

item_number=item_num;

name=nm;

quantity=quan;

price=pri;

total_cost = 0;

}

public int getitem_number(){

return item_number;

}

public String getname() {

return name;

}

public int getquantity() {

return quantity;

}

public double getprice() {

return price;

}

public double gettotal_cost() {

return total_cost;

}

public void total() {

total_cost=price * quantity;

}

public void displayLine() {

System.out.println("Item Number:"+item_number);

System.out.println("Name: "+name);

System.out.println("Quantity: "+quantity); System.out.println("Price: "+price);

System.out.println("Total Cost:

"+total_cost);

}

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT