ANSWER it fast
Question 9:
Define a class overload, described as below:
Data members:
int a, b, s;
int n1,n2, n3;
double avg;
int a1,a2;
Member function:
void Input() – to input two numbers in a and b, to input three numbers n1, n2,
n3 , to input the age of two siblings a1, a2
void sum() - to add and store in s.
void Average() - to calculate and store average of the numbers
void eligibility () - to check the eligibility of the siblings
void Print() - to print all the data members.
Write a main() method to create and object of the class and call the above member methods.
Answers
Answer:
bhai is ka answer to muj ko bhi nahi mil raha ha baki ka method pgm and sum series hogya ha woh us ma sa koi pucho baki 19 ma sa
The program is given below:
import java.util.*;
class overload
{
int a,b,s;
int n1,n2,n3;
double avg;
int a1,a2;
void input()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the numbers in variable a and b");
a = sc.nextInt();
b = sc.nextInt();
System.out.println("Enter the numbers in variable n1, n2 and n3");
n1 = sc.nextInt();
n2 = sc.nextInt();
n3 = sc.nextInt();
System.out.println("Enter the age of the siblings");
a1 = sc.nextInt();
a2 = sc.nextInt();
}
void sum()
{
s = (a+b+n1+n2+n3+a1+a2);
}
void Average()
{
avg = (a+b+n1+n2+n3+a1+a2)/7.0;
}
void eligibility()
{
if(a1>=18 && a2>=18)
System.out.println("Eligible);
else
System.out.println("Not Eligible");
}
void Print()
{
System.out.println("The data members used in the program is listed below");
System.out.println(a);
System.out.println(b);
System.out.println(n1);
System.out.println(n2);
System.out.println(n3);
System.out.println(a1);
System.out.println(a2);
System.out.println("The sum of the numbers are: "+s);
System.out.println("The average of the numbers are: "+avg);
}
void main()
{
Overload ob = new Overload();
ob.input();
ob.sum();
ob.Average();
ob.eligibility();
ob.Print();
}
}