Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 90

Ex no:1

Programs Using Control Structures

Date:

Question 1:

Write a program to accept gender ("Male" or "Female") and age (1-120) from command line

arguments and print the percentage of interest based on the given conditions.

Interest == 8.2% Gender ==> Female Age ==>1 to 58 Interest == 7.6% Gender

==> Female Age ==>59 -120Interest == 9.2% Gender ==> Male Age ==>1-60

Interest == 8.3% Gender ==> Male Age ==>61-120.

Aim:

To develop java program for printing the percentage of interest based on the given conditions.

Code:
package module1;

public class interest{

public static void main(String[] args) {


System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("array_sarching");

int Age=Integer.parseInt(args[0]);

if(Age>=120) {
System.out.println("age is > 120");
}
else if(Age>=1 && Age<=58) {
System.out.println("Interest == 8.2% Gender");

}
else if(Age>=59 && Age<=120) {
System.out.println("Interest == 7.6% Gender");
}
else if(Age>=1 && Age<=58) {
System.out.println("Interest == 9.2% Gender");
}
else if(Age>=58 && Age<=120) {
System.out.println("Interest == 9.2% Gender");
}

717822L210
Output:

Result:

Thus,the java program to find the interest percentage of the user is compiled,executed and verified

successfully.

717822L210

667t
717822L210
667t
Question 2:

Write a program to convert from upper case to lower case and vice versa of an alphabet andprint the old

character and new character as shown in example (Ex: a->A, M->m).

Aim:

To develop java program for converting from upper case to lower case and vice versa of an alphabet andprint

the old character and new character.

Code:

package module1;

import java.util.Scanner;

public class upper_lower {

public static void main(String[] args) {


// TODO Auto-generated method stub

System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Uppercase_Lowercase");
Scanner et=new
Scanner(System.in); char
alphabet=et.next().charAt(0); int
Al=alphabet+32;
int La=alphabet-32;
if(alphabet>95){
System.out.println((char)(La));
}
else{
System.out.println((char)(Al));
}
}
}

717822L210
717822L205
Output:

Result:

Thus,the java program to conver the lower case character to upper case is compiled,executed and verified

successfully.

717822L210

667t
717822L205
Question 3:

Write a program to check if a given number is prime or not.

Aim:

To develop java program for checking if a given number is prime or not.

Code:
package module1;
import java.util.Scanner;
public class primenumber {
public static void main(String[] args) {
// TODO Auto-generated method stub

System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Check Prime Number or Not");
Scanner scr=new Scanner(System.in);
int count=0;
int N=scr.nextInt();
if(N>1) {
for(int i=1;i<=N;i++) {
if(N%i==0) {
count++;
}
}
if(count==2) {
System.out.println(N+ " is a prime number");
}
else {
System.out.println(N+ " is not a prime number");
}
}
else{
System.out.println(" not prime number");
}
}
}

717822L210

667t
Output:

Result:

Thus,the java program to find the given number number is prime or not is compiled,executed and verified

successfully.

717822L210

717822L205
Question 4:

Write a program to print even numbers between 23 and 57, each number should be printed in a separate

row.

Aim:

To develop java program for printing even numbers between 23 and 57, each number should be printed

in a separate row.

Code:

package module1;

public class EvenNumbers {


public static void main(String[] args)
{
System.out.println("717822l210");
System.out.println("Dheivani M");
System.out.println("evennumber 23-57");
for(int i=23;i<58;i++)
{

if(i%2==0)
{
System.out.println(i);
}
}
}

717822L210

667t
Output:

Result:

Thus,the java program to print even numbers between 23 and 57 is compiled,executed and verified

successfully.

717822L210
717822L205
667t
Question 5:

Write a Java program to find if the given number is prime or not.

Aim:

To develop java program for finding if the given number is prime or not.

Code:
package module1;

public class prime_or_composite {

public static void main(String[] args) {


System.out.println("717822l210");
System.out.println("Dheivani M");
System.out.println("Prime or Composite");
System.out.println("Enter a Number:");
int a;
a=Integer.parseInt(args[0]);
if(a>1 && a==0||a==1) {

System.out.println(a+ " neither prime nor composite");


}

int m=0;
for(int i=2;i<a;i++) {
if(a%i==0) {
m=+1;
}
}

if(m==0) {
System.out.println(a+ " is a prime number ");
}
else
{ System.out.println(a+ " is not a prime number");

}
}
}

717822L210
717822L205
717822L205
667t
Output:

Result:
Thus,the java program to find given number is prime or not is compiled,executed and verified successfully.

717822L210
717822L205
717822L205
667t
Question 6:

Write a program to print * in Floyds format (using for and while loop)

Aim:

To develop java program for printing * in Floyds format .

Code:

public class floyds {

public static void main(String[] args) {


System.out.println("717822l210");
System.out.println("Dheivani M");
System.out.println("floyds");
int num=Integer.parseInt(args[0]);
for(int i=1;i<=num;i++) {
for(int j=1;j<=i;j++) {
System.out.print(" *");

}
System.out.println();
}

717822L210

717822L210
667t
Output:

Result:
Thus,the java program to print floyds pattern is compiled,executed and verified successfully.

717822L210
717822L210
667t
Question 7:

Write a program to reverse a given number and print

Aim:

To develop java program to reverse a given number and print.

Code:
public class reverse {

public static void main(String[] args) {

System.out.println("717822l210");
System.out.println("Dheivani M");
System.out.println("Given order digit");
int num=Integer.parseInt(args[0]); int
rem=0;
int rev=0;
while(num>0) {
rem=num%10;
rev=rev*10+rem;
num/=10;
}
System.out.println(rev);
}

717822L210
717822L210
667t
Output:

Result:

Thus,the java program to reverse the given number is compiled,executed and verified

successfully.

717822L210
717822L210
667t
Question 8:

Write a program that displays a menu with options 1. Add 2. Sub Based on the options chosen, read 2

numbers and perform the relevant operation. After performing the operation, the program should ask the

user if he wants to continue. If the user presses y or Y, then the program should continue displaying the

menu else the program should terminate.

Aim:

To develop java program that displays a menu with Add and Subtract options.

Code:
package module1;
import java.util.Scanner;
public class switch_case {
public static void main(String[] args) {
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Switch_Case");
char ch;
do {

int choice;

System.out.println("Enter 2 numbers");
Scanner scr = new Scanner(System.in);
int a= scr.nextInt();
int b= scr.nextInt();
System.out.println("Enter choice");
System.out.println("Press 1 for an
Addition");
System.out.println("Press 2 for an Subraction");
choice = scr.nextInt();
switch(choice) {
case 1:
int
res;
res=a+b
;
System.out.println(res);
break;
case 2:
int
res1;
res1=a-
b;
System.out.println(res1);
break;

}
System.out.println("if you want to continue,Enter 'Y' or'y'
character");

ch =scr.next().charAt(0);
717822L205
}
while(ch == 'y' || ch =='Y'); }

717822L210

717822L210
OUTPUT:

Result:

Thus,the java program to perform addition and subtraction operation using switch case is

compiled,executed and verified successfully.

717822L210

717822L205
717822L210
Question 9:

Write a program to print first 5 values which are divisible by 2, 3, and 5.

Aim:

To develop java program for divisible by 2,3 and 5.

Code:

public class divisiblenumber {

public static void main(String[] args) {


System.out.println("717822l210");
System.out.println("Dheivani M");
System.out.println("divisible by 2,3,5");
int count=0; int
num=1;
while(count<5) {
if(num % 2 == 0 && num % 3 == 0 && num % 5 == 0) {
System.out.println(num);
count++;
}
num++;
}

717822L210
717822L205
Output:

Result:

Thus,the java program to print the number which are divisible by 2,3 and 5 was executed
successfully and the output was verified.

717822L205

717822 L205
EX NO:2
PROGRAM USING ARRAY

DATE:

10. Question:

Write a java program to check whether the number is present in the array or not.

Aim:

To develop java program to check whether the target number is present or not.

Code:

package module1;
import java.util.Scanner;
public class array_searching {
public static void main(String[] args) {
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("array_sarching");
int arr[]=new int[] {1,2,4,6,8,12}; int
count=0;
Scanner scr=new Scanner(System.in);
System.out.println("Enter the search element");
int k=scr.nextInt();
for(int i=0;i<5;i++)
{
if(arr[i]==k)
{
System.out.println("Index="+ (i+1));
count++;
}
}
if(count==0)
{
System.out.println("-1");
}

}
}
717822L205

717822 L205
Output:

Result:

Thus, the java program to find the target element is present or not was executed successfully and the

output was verified.


11. Question:

Write a program to remove the duplicate elements in an array and print Eg)

Array Elements--12, 34,12,45,67,89 O/P: 12,34,45,67,89.

Aim:

To develop java program to remove duplicate element from the given array.

Code:

package module1;
import java.util.Scanner;
public class duplicates {
public static void main(String[] args) {
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Remove duplicates Element From an Array");
System.out.println("Enter array of the size");
Scanner scr=new Scanner(System.in);
int n=scr.nextInt();
int arr[]=new int[n];
int b[]=new int[n];
int count=0,k=0;
System.out.println("Enter array Elements");
for(int i=0;i<n;i++)
{
arr[i]=scr.nextInt();
}
for(int i=0;i<n;i++)
{
count=0;
for(int j=i+1;j<n;j++)
{
if (arr[i]==arr[j])
{
count++;
break;
}
}
if(count==0)
{
b[k]=arr[i];
k++;
}

}
System.out.println("The new array is");
for(int i=0;i<k;i++)
{
System.out.print(" "+b[i]);
}
}
717822L210
717
Output:

Result:

Thus, the java program to remove the duplicate element in the array was executed successfully and the

output was verified.

717822L210
12. Question:

Write a program to print the sum of the elements of the array with the given below condition. If the

array has 6 and 7 in succeeding orders,ignore 6 and 7 and the numbers between them for the

calculation of Sum.

Aim:

To develop java program to calculate the sum of elements in an array based on the condition.

Code:
package module1;
import java.util.Scanner;
public class sum_of_array {

public static void main(String[] args) {

Scanner scr=new Scanner(System.in);


System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("sum_of_array");
int n,i,j,k=0,sum=0,s=0,total;
System.out.println("Enter array size");
n=scr.nextInt();
int a[]=new int[n];
int b[]=new int[n];
System.out.println("Enter array Elements");
for(i=0;i<n;i++)
{
a[i]=scr.nextInt();
sum+=a[i];
}
for(i=0;i<n;i++)
{
if(a[i]==6)
{
for(j=i;j<n;j++)
{
b[k]=a[j];
if(b[k]!=7)
{
s=s+b[k];
}
else
{
s=s+7;
break;
}
}
k++;
}
}
total=sum-s;
System.out.println("The sum is "+total);
}
}

717822L210
Output:

Result:

Thus, the java program to find the sum of array for specific condition was executed successfully and the

output was verified.

717822L210
13. Question:

Write a program to reverse the elements of a given 2*2 array based on command line arguments.

Aim:

To develop java program to reverse the elements of a given 2*2 array based on

command line arguments.

Code:

package module1;
public class reverse_array {
public static void main(String[] args) {

System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Reverse of the Array");
int n;
n=args.length;
if(n!=4)
{
System.out.println("Enter valid number");
}
if(n==4)
{
int arr[][]=new int [2][2];
int i,j,p=0; for(i=0;i<2;i+
+)
{
for(j=0;j<2;j++)
{
arr[i][j]=Integer.parseInt(args[p]);
p++;
}
}
System.out.println("The giveen array is:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
System.out.print(" "+arr[i][j]);

}
}
System.out.println();
System.out.println("The reverse of the array is:");
for(i=1;i>=0;i--)
{
for(j=1;j>=0;j--)
{
System.out.print(" "+arr[i][j]);
}
}
}
}
}

717822L210
Output:

Result:

Thus, the java program to reverse the 2*2 array was executed successfully and the output was verified.

717822L210
14. Question:

Write a program to find greatest number in a 3*3 array based on the command line arguments.

Aim:

To develop java program to find greatest number in a 3*3 array based on the command line

arguments.

Code:

package module1;
public class max_of_array{
public static void main(String[] args) {
System.out.println("717822L210");
System.out.println("Dheivani M");
if (args.length != 9) {
System.out.println("Please enter 9 integer numbers");
return;
}
int[][] arr = new int[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
arr[i][j] = Integer.parseInt(args[i * 3 + j]);
}
}
int largestNumber = arr[0][0];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (arr[i][j] > largestNumber) {
largestNumber = arr[i][j];

}
}
}
System.out.println("The given array is:");
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
System.out.print(arr[i][j] + " ");
}
System.out.println();
}
System.out.println("The biggest number in the given array is " +
largestNumber);
}

717822L210
Output:

Result:

Thus, the java program to find the maximum element in the given 3*3 array is was executed

successfully and the output was verified.

717822L210
Ex no:03 PROGRAMS ON CLASSES AND OBJECTS

Date:

Question 15:

Create a new class called “Calculator” which contains the following: A static method called powerInt(int

num1,int num2) that accepts two integers andreturns num1 to the power of num2 (num1 power num2).A

static method called powerDouble(double num1,int num2) thataccepts one doubleand one integer and

returns num1 to the power of num2 (num1power num2).Call your method from another class without

instantiating the class (i.e. call it like Calculator.powerInt(12,10) since your methods are defined to be static)

Hint: Use Math.pow(double,double) tocalculate the power.

Aim:

To develop java program to find the power of numbers using classes and objects.

Code:
package module1;

public class Calculator {


public static int powerInt(int a,int b)
{
int c=1;
for(int i=0;i<b;i++)
{
c=c*a;
}
return c;
}
public static double powerDouble(double a,int b) {
return Math.pow(a, b);
}
}
package module1;

public class Calci {


public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Program to find power using classes and
objects");
System.out.println("power int method
is="+Calculator.powerInt(20,2));
System.out.println("power double
methodis="+Calculator.powerDouble(14,20));
}

}
717822L210
Output:

Result:

Thus,the java program to calculate the power of the numbers using classes and objects was executed
successfully and the output was verified.

717822L210
Question 16:

Write a java program to Calculate the BMI of the patient using classes and objects. BMI can be

calculated as, BMI = ( Weight in Pounds / ( Height in inches x Height in inches ) ) x 703.

Aim:

To develop java program for calculating the BMI of the patient using classes and objects.

Code:
package module1;

public class PatientsBMI {


String name;
double height,weight;
public void details(String name)
{
System.out.println("Patient name= "+name);
}
public double BMI(double height,double weight)
{
return ((weight/(height*height))*703);
}

}
package module1;
import java.util.Scanner;
public class BMIDemo {

public static void main(String[] args) {


// TODO Auto-generated method stub
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("To find the BMI of the patient");
PatientsBMI p1=new PatientsBMI();
System.out.println("Enter patient name");
Scanner scr=new Scanner(System.in);
String name=scr.next();
p1.details(name);
System.out.println("Enter height and weight");
double height=scr.nextDouble();
double weight=scr.nextDouble();
System.out.println("BMI of the patient "+p1.BMI(height,weight));
}
}

717822L210
717822L205
Output:

Result:

Thus,the java program to calculate the BMI of the patient using classes and objects was executed

successfully and the output was verified.

717822L210
Question 17:

Consider the following UML class diagram:

• Write a Java class for the Circle class based on the UML class diagram.
• Write a main class TestCircle that creates two objects for the Circle class and invoke all the
methods.

Aim:

To develop java program to find the area of the circle using classes and objects.

Code:

package module1;

public class circle {


private double radius;
private String colour;

public circle()
{
this.radius=1.0;
this.colour="red";
}
public circle(double radius)
{
this.radius=radius;
}
public circle(double radius,String colour)
{
this.radius=radius;
this.colour=colour;
}
public double getRadius() {
return radius;
Salini V
} 717822l210
public void setRadius(double radius) {
this.radius=radius;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour=colour;
}
public double getArea() {
return 3.14*this.radius*this.radius;
}
public double getCircumference() {
return 2*3.14*this.radius;
}
public String toString () {
return "circle[radius="+radius+"colour="+colour+"]";
}

public static void main(String[]args){


System.out.println("717822L210");
System.out.println("Dheivani M");
circle c1=new circle();
System.out.println("Radius1 : "+c1.radius+" "+"Colour1 : "+c1.colour);
System.out.println("Area1 : "+c1.getArea());
circle c2=new circle(7.0,"Blue");
System.out.println("Radius2 : "+c2.radius+" "+"Colour2 : "+c2.colour);
System.out.println("Area2 :"+c2.getArea());
c2.setRadius(8);
System.out.println("Area3 :"+c2.getArea());
}
}

717822L210
Salini V
Output:

Result:

Thus,the java program to calculate the Area of the circle using classes and objects was executed

successfully and the output was verified.

717822 L205
717822L210
717822 L205
Question 18:

Consider the following UML class diagram:

Write a Java class for the Rectangle class based on the UML class diagram. • Write a main class TestRectangle

that creates two objects for the Rectangle class and invoke all the methods.

Aim:

To develop java program for calculating the area and perimeter of the rectangle using classes and objects.

Code:
package module1;

public class Rectangle {


private float length;
private float width;
public Rectangle()
{
length=1.0f;
width=1.0f;
}
public Rectangle(float length,float width)
{
this.length=length;
this.width=width;
}
public float getLength()
{
return length;
}
public void setLength(float length)
{
this.length=length;
}
public float getWidth()

717822L210
{
return width;
}
public void setWidth(float width)
{

this.width=width;
}
public double getArea()
{
return length*width;
}
public double getPermiter()
{
return 2*(length+width);
}
public String toString()
{
return "Rectangle[length="+length+",width="+width+"]";
}
}
package module1;

import java.util.Scanner;
public class TestRectangle {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("717822L205");
System.out.println("BARATHKUMAR V");
System.out.println("find Area and Perimeter of the rectangle using classes and
Objects");

Rectangle s1=new Rectangle();


System.out.println("Area of the Rectangle= "+s1.getArea());
System.out.println("Perimeter of the Rectangle= "+s1.getPermiter());
Scanner scr=new Scanner(System.in);
System.out.println("Enter length and width");
float length=scr.nextFloat();
float width=scr.nextFloat();
Rectangle s2=new Rectangle(length,width);
System.out.println("Area of the Rectangle= "+s2.getArea());
System.out.println("Perimeter of the Rectangle= "+s2.getPermiter());
System.out.println(s2);
}
}

717822L210

717822 L205
OUTPUT:

Result:

Thus,the java program to Calculate the Area and perimeter of the Rectangle using classes and objects was
executed successfully and the output was verified.

717822L210
717822L205
717822L205
Question 19:

Consider the following UML class diagram:

• Write a Java class for the Employee class based on the UML class diagram.

• Write a main class TestEmployee that creates two objects for the Employee class and invoke all the
methods.

Aim:

To develop java program to find the total salary,Salary increment percentage of the employee using classes

and objects.

Code:
package module1;

public class employee {


private int id;
private String firstname;
private String lastname;
private int salary;
public int p;
public employee ()
{
}

public employee (int id,String firstname,String lastname,int salary)


{
this.id=id;
this.firstname=firstname;
this.lastname=lastname;
this.salary=salary;
}
717822L210

717822L205
{
return id;
}
public String getFirstname()
{
return firstname;
}
public String getLastname()
{
return lastname;
}
public int getSalary()
{
return salary;
}
public void setId(int id)
{
this.id=id;
}
public void setFirstname(String firstname)
{
this.firstname=firstname;
}
public void setLastname(String lastname)
{
this.lastname=lastname;
}
public void setSalary(int salary)
{
this.salary=salary;
}
public int getAnnualsalary()
{
return salary*12;
}
public int getRaisesalary(int percent)
{
int a=salary*percent/100;
return a+salary;
}
public String toString()
{
return

"Employee[id="+id+",name="+firstname+lastname+",salary="+salary+"]";

}
package module1;
import java.util.Scanner;
public class Testemployee {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("Program to calculate the total salary and
increment percentage");
System.out.println("of the employee using classes and objects.");
employee e1 = new employee();
e1.setId(154); 717822L210
e1.setFirstname("swathi");
e1.setLastname("s");
e1.setSalary(15000);
System.out.println("ID:"+e1.getId());
System.out.println("Firstname:"+e1.getFirstname());
System.out.println("Lastname:"+e1.getLastname());
System.out.println("Salary:"+e1.getSalary());
System.out.println("Annual Salary:"+e1.getAnnualsalary());
System.out.println("Increment salary:"+e1.getRaisesalary(50));
System.out.println("Enter id,firstname,lastname and salary");
Scanner scr=new Scanner(System.in);
int id=scr.nextInt();
String firstname=scr.next();
String lastname=scr.next();
int salary=scr.nextInt();
employee e2 = new employee(id,firstname,lastname,salary);
System.out.println("ID:"+e2.getId());
System.out.println("Firstname:"+e2.getFirstname());
System.out.println("Lastname:"+e2.getLastname());
System.out.println("Salary:"+e2.getSalary());
System.out.println("Annual Salary:"+ e2.getAnnualsalary());
System.out.println("Increment Salary:"+e2.getRaisesalary(50));
System.out.println(e1);
System.out.println(e2);
}

717822L210

717822L205
717822L210
OUTPUT:

Result:

Thus,the java program to calculate the total salary and salary increment percentage of the employee was executed

successfully and the output was verified.

717822L205
717822L210
Question 20:

Consider the following UML class diagram:

• Write a Java class for the InvoiceItem class based on the UML class diagram.

• Write a main class TestInvoiceItem that creates two objects for the Employee class and invoke all the methods.

Aim:

To develop java program for the InvoiceItem UML class diagram by using classes and objects.

Code:
package module1;

public class invoice_item {


private String id;
private String desc;
private int qty;
private double unitprize;
public invoice_item()
{
id="18";
desc="SellerName:virat";
qty=30;
unitprize=6.0;
}
public invoice_item(String id,String desc,int qty,double unitprize)
{
this.id=id;
this.desc=desc;
this.qty=qty;

717822L210

717822L210
}
public String getId()
{
return id;
}
public String getDesc()
{
return desc;
}
public int getQty()
{
return qty;
}
public double getUnitprize()
{
return unitprize;
}
public void setId(String id)
{
this.id=id;
}
public void setDesc(String desc)
{
this.desc=desc;
}
public void setQty(int qty)
{
this.qty=qty;
}
public void setUnitprize(double unitprize)
{
this.unitprize=unitprize;
}
public double getTotal()
{
return unitprize*qty;
}
public String toString()
{
return

"InvoiceItem=[id="+id+",desc="+desc+",qty="+qty+",unitprize="+unitprize+
"]";

}
a

}
package module1;
import java.util.Scanner;
public class testinvoice {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("717822L210");
System.out.println("Dheivani M");
System.out.println("find the total prize using class and object");

invoice_item i1=new invoice_item();


System.out.println(i1.getId());
System.out.println(i1.getDesc());
System.out.println(i1.getQty());
System.out.println(i1.getUnitprize());
System.out.println("Total= "+i1.getTotal());

Scanner scr=new Scanner(System.in);


System.out.println("Enter id,desc,qty,unitprize");
String id=scr.next();
String desc=scr.next();
int qty=scr.nextInt();
double unitprize=scr.nextDouble();
invoice_item i2 = new invoice_item(id, desc,qty, unitprize);
System.out.println(i2.getId());
System.out.println(i2.getDesc());
System.out.println(i2.getQty());
System.out.println(i2.getUnitprize());
System.out.println("Total= "+i2.getTotal());
System.out.println(i1);
System.out.println(i2);
}

717822L210

717822L210
717822L205
OUTPUT:

717822L210

717822L210
717822L205
717822L210
Result:

Thus,the java program to invoke all the methods in the UML diagram for InvoiceItem was executed

successfully and the output was verified.

PREPARATION 30

LAB PERFORMANCE 30

REPORT 40

TOTAL 100

INITIAL OF FACULTY

717822L205

You might also like