0% found this document useful (0 votes)
3 views24 pages

Java Week7

The document contains coding assignments for students at Rajalakshmi Engineering College, specifically focusing on energy consumption calculations and BMI calculations using Java. It includes problem statements, input/output formats, and sample test cases for both assignments. Each assignment is graded, with the student achieving full marks in both tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views24 pages

Java Week7

The document contains coding assignments for students at Rajalakshmi Engineering College, specifically focusing on energy consumption calculations and BMI calculations using Java. It includes problem statements, input/output formats, and sample test cases for both assignments. Each assignment is graded, with the student achieving full marks in both tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
2028_REC_OOPS using Java_Week 7_Q1

Attempt : 1
Total Mark : 10
Marks Obtained : 10

Section 1 : Coding

1. Problem Statement:
7

7
01

01

01

01
Rajiv is analyzing the energy consumption in his household and wants to
01

01

01

01
10

10

10

calculate the total cost based on the daily energy usage. He is given the 10
24

24

24

24
rate per unit of electricity and the energy consumed for multiple days. To
structure this calculation efficiently, he decides to use an interface-based
approach.

Implement an interface CostCalculator with the necessary methods to


retrieve energy details and compute the cost. The calculations should be
handled in the EnergyConsumptionTracker class, while the
EnergyConsumptionApp class should only handle input and output.

Formula
7

7
01

01

01

1
10
01

01

01

Energy Cost for one day = Energy Consumed per day * Rate Per Unit
10

10

10

10
24

24

24

24
17

7
Input Format

01

01

01
10

01

01

01
0

The first line of input consists of the rate per unit as an 'R' (a double value).
10

10

10

10
24

24

24

24
The second line of input consists of the number of days 'N' (an integer).

The third line of input consists of the daily energy consumption values for each
day 'D" (double values), separated by space.
Output Format
The first line of the output prints: "Day-wise Energy Cost:"

The next N lines of the output print the day-wise energy costs(double type) and
the total energy cost (double type) in Indian Rupees in the following format: "Day
7

17

17
01

01
10

0
[day_number]: Rs. [energy_cost]"
01

01

01
00
10

10

10
1
24

24

24

24
The last line of the output prints: "Total Energy Cost: Rs. [total_cost]"

Note: energy_cost and total_cost are rounded off to two decimal points

Refer to the sample output for the formatting specifications.


7

7
01

01

01

01
01

01

01

01
Sample Test Case
10

10

10

10
24

24

24

24
Input: 0.01
3
10.0 20.0 30.0
Output: Day-wise Energy Cost:
Day 1: Rs. 0.10
Day 2: Rs. 0.20
Day 3: Rs. 0.30
Total Energy Cost: Rs. 0.60
Answer
7

import [Link];
01

01

01

1
10
01

01

01

interface CostCalculator{
10

10

10

10
24

24

24

24
void getEnergyDetails(Scanner scanner);
17

7
01

01

01
void calculateAndDisplayCost();
10

01

01

01
0

}
10

10

10

10
24

24

24

24
class EnergyConsumptionTracker implements CostCalculator{
private double rate;
private int nDays;
private double[] dailyConsumption;
private double[] dailyCosts;
private double totalCost;

public EnergyConsumptionTracker(double rate, int nDays){


[Link] = rate;
[Link] = nDays;
7

17

17
01

01
[Link] = new double[nDays];
10

0
01

01

01
00

[Link] = new double[nDays];


10

10

10
1

}
24

24

24

24
@Override
public void getEnergyDetails(Scanner scanner){
for(int i=0; i<nDays; i++){
dailyConsumption[i] = [Link]();
}
}

@Override
public void calculateAndDisplayCost(){
7

7
01

01

01

01
double totalCost = 0;
01

01

01

01
double[] dailyCosts = new double[nDays];
10

10

10

for(int i=0; i<nDays; i++){ 10


24

24

24

24
dailyCosts[i] = dailyConsumption[i] * rate;
totalCost += dailyCosts[i];
}

[Link]("Day-wise Energy Cost: ");

for(int i=0; i<nDays; i++){


[Link]("Day %d: Rs. %.2f%n", (i+1), dailyCosts[i]);
}
[Link]("Total Energy Cost: Rs. %.2f%n", totalCost);
7

7
01

01

01

}
10
01

01

01

}
10

10

10

10
24

24

24

24
class EnergyConsumptionApp {
17

7
01

01

01
public static void main(String[] args) {
10

01

01

01
0

Scanner scanner = new Scanner([Link]);


10

10

10

10
24

24

24

24
double ratePerUnit = [Link]();
int numDays = [Link]();

CostCalculator tracker = new EnergyConsumptionTracker(ratePerUnit,


numDays);

[Link](scanner);
[Link]();

[Link]();
7

17

17
01

01
}
10

0
01

01

01
00

}
10

10

10
1
24

24

24

24
Status : Correct Marks : 10/10
7

7
01

01

01

01
01

01

01

01
10

10

10

10
24

24

24

24
7

7
01

01

01

1
10
01

01

01

0
10

10

10

10
24

24

24

24
17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
2028_REC_OOPS using Java_Week 7_Q2

Attempt : 1
Total Mark : 10
Marks Obtained : 10

Section 1 : Coding

1. Problem Statement
7

7
01

01

01

01
Jaheer is working on a health monitoring system to help individuals
01

01

01

01
10

10

10

calculate their Body Mass Index (BMI). He has implemented a basic BMI 10
24

24

24

24
calculator and an interface called HealthCalculator. It should have a
method called calculateBMI.

You are tasked with creating a program that takes weight and height as
input, calculates the BMI using the BMICalculator class, and displays the
result. If the height or weight is less than or equal to zero, then return -1.

Formula: BMI = weight / (height * height)

Input Format
7

7
01

01

01

1
10
01

01

01

The first line of input consists of a double value W, the person's weight in
0
10

10

10

10

kilograms.
24

24

24

24
17

7
01

01

01
The second line consists of a double value H, the height of the person in meters.
10

01

01

01
0
10

10

10

10
Output Format
24

24

24

24
The output displays "BMI: " followed by a double value, representing the
calculated BMI, rounded off to two decimal places.

Refer to the sample output for formatting specifications.


Sample Test Case
Input: 70.0
7

17

17
01

01
10

0
1.75
01

01

01
00
10

10

10
Output: BMI: 22.86
1
24

24

24

24
Answer
import [Link];
interface HealthCalculator{
double calculateBMI(double weight, double height);
}

class BMICalculator implements HealthCalculator{

@Override
7

7
01

01

01

01
public double calculateBMI(double weight, double height){
01

01

01

01
return (weight/(height*height));
10

10

10

} 10
24

24

24

24
}
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);

double weight = [Link]();


double height = [Link]();

BMICalculator bmiCalculator = new BMICalculator();


7

7
01

01

01

1
10

double bmi = [Link](weight, height);


01

01

01

0
10

10

10

10
24

24

24

24
24 24 24 24
10 10 10 10

}
01 01 01 0

}
01 01 01 10
7 7 7 17

Status : Correct
[Link]();

24 24 24 24
10 10 1 00 10
01 01 10 01
01 01 01
7 7 17 7
[Link]("BMI: %.2f\n", bmi);

24 24 24 24
10 10 10 10
01 01 01 01
01 01 01 01
7 7 7 7

24 24 24 24
10 10 10 10
Marks : 10/10

0 10 01 01 01
1 01 0 01
7 7 17 7
17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
2028_REC_OOPS using Java_Week 7_Q3

Attempt : 1
Total Mark : 10
Marks Obtained : 10

Section 1 : Coding

1. Problem Statement
7

7
01

01

01

01
A financial analyst, Alex, needs a program to calculate simple interest for
01

01

01

01
10

10

10

various financial transactions. He requires a straightforward tool that takes 10


24

24

24

24
in the principal amount, interest rate, and time in years and computes the
interest.

The formula to be used is: Interest = Principal × Rate × Time / 100

Implement this functionality using the InterestCalculator interface and the


SimpleInterestCalculator class.

Input Format
7

The first line of input consists of the principal amount P as a double value.
01

01

01

1
10
01

01

01

0
10

10

10

10
24

24

24

24
The second line of input consists of the annual interest rate r as a double value.
17

7
01

01

01
10

01

01

01
0

The third line of input consists of the number of years t as a positive integer,
10

10

10

10
which is an integer value.
24

24

24

24
Output Format
The output displays the calculated simple interest in the following format:
"Simple Interest: [interest_value]", Here, [interest_value] should be replaced with
the actual interest value calculated by the program.

Refer to the sample output for the formatting specifications.


7

17

17
01

01
10

0
01

01

01
Sample Test Case
00
10

10

10
1
24

24

24

24
Input: 1000.00
5.00
2
Output: Simple Interest: 100.0
Answer
import [Link];
interface InterestCalculator{
double simpleInterest(double principal, double rate, int time);
}
7

7
01

01

01

01
01

01

01

01
class SimpleInterestCalculator implements InterestCalculator{
10

10

10

10
24

24

24

24
@Override
public double simpleInterest(double principal, double rate, int time){
return ((principal*rate*time)/100.0);
}
}
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);
7

double principal = [Link]();


01

01

01

1
10
01

01

01

0
10

10

10

10

double rate = [Link]();


24

24

24

24
17

7
01

01

01
int time = [Link]();
10

01

01

01
0
10

10

10

10
InterestCalculator calculator = new SimpleInterestCalculator();
24

24

24

24
double interest = [Link](principal, rate, time);

[Link]("Simple Interest: " + interest);

}
}

Status : Correct Marks : 10/10


7

17

17
01

01
10

0
01

01

01
00
10

10

10
1
24

24

24

24
7

7
01

01

01

01
01

01

01

01
10

10

10

10
24

24

24

24
7

7
01

01

01

1
10
01

01

01

0
10

10

10

10
24

24

24

24
17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
2028_REC_OOPS using Java_Week 7_Q4

Attempt : 1
Total Mark : 10
Marks Obtained : 10

Section 1 : Coding

1. Problem Statement
7

7
01

01

01

01
Maria, a software developer, is working on an inventory management
01

01

01

01
10

10

10

system project using Java that utilizes an inventory interface to manage a 10


24

24

24

24
store's products.

The interface should define two methods: addProduct, which adds a


product by accepting its name, price, and quantity, and
calculateTotalValue, which computes the total value of all products in the
inventory. Implement the interface in a class called SimpleInventory, which
internally manages a list of Product objects.

Each Product object should encapsulate the product's name, price, and
quantity and include a method to calculate its value as price × quantity.
7

7
01

01

01

1
10

The system should allow users to dynamically add products to the


01

01

01

0
10

10

10

10

inventory and calculate the total value of all products stored.


24

24

24

24
17

7
Help Maria achieve the task.

01

01

01
10

01

01

01
0
10

10

10

10
Input Format
24

24

24

24
The first line of input consists of an integer to choose one of the following
options:

1 - to add a product to the inventory.

2 - to calculate and view the total inventory value.

3 - to exit the program.

For Choice 1 (Add Product):


7

17

17
01

01
10

0
01

01

01
00

The next input line is the string representing the product name as a string (single
10

10

10
1
24

24

24

24
or multi-word, without quotes).

The next line is a double value representing the price as a decimal value

The next line is an integer value representing the quantity as an integer

For Choices 2 and 3, no additional input is required


Output Format
The output displays the results of the commands as follows:
7

7
01

01

01

01
- For the addProduct command, the program should display "Product added to
01

01

01

01
10

10

10

10
inventory."
24

24

24

24
- For choice 2, the program should display "Total inventory value [totalvalue].
"The total value should be displayed with one decimal place. If there is no
product in the inventory, print the total as 0.0.
- For choice 3, the program should exit

If the choice is not 1, 2, or 3, then print "Invalid choice. Please select a valid
option (1/2/3).".
7

7
01

01

01

1
10

Refer to the sample output for the formatting specifications.


01

01

01

0
10

10

10

10
24

24

24

24
Sample Test Case
17

7
01

01

01
10

01

01

01
Input: 1
0
10

10

10

10
Laptop
24

24

24

24
800.0
3
2
5
3
Output: Product added to inventory.
Total inventory value: $2400.0
Invalid choice. Please select a valid option (1/2/3).
Answer
7

17

17
import [Link];
01

01
10

0
01

01

01
00

class Product{
10

10

10
1
24

24

24

24
String name;
double price;
int quantity;

public Product(String name, double price, int quantity){


[Link] = name;
[Link] = price;
[Link] = quantity;
}

public double getValue(){


7

7
01

01

01

01
return ([Link] * [Link]);
01

01

01

01
}
10

10

10

10
24

24

24

24
}

interface Inventory{
void addProduct(String name, double price, int quantity);
double calculateTotalValue();
}

class SimpleInventory implements Inventory{


private Product[] products;
private int productCount;
7

7
01

01

01

1
10

public SimpleInventory(int capacity){


01

01

01

[Link] = new Product[capacity];


10

10

10

10
24

24

24

24
[Link] = 0;
17

7
01

01

01
}
10

01

01

01
0
10

10

10

10
@Override
24

24

24

24
public void addProduct(String name, double price, int quantity){
if(productCount < [Link]){
Product newProduct = new Product(name, price, quantity);
products[productCount] = newProduct;
productCount++;
}
[Link]("Product added to inventory.");
}

@Override
7

17

17
01

01
public double calculateTotalValue(){
10

0
01

01

01
00

double totalValue = 0.0;


10

10

10
1

for(int i=0; i<productCount; i++){


24

24

24

24
totalValue += products[i].getValue();
}
return totalValue;
}
}
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);
Inventory inventory = new SimpleInventory(10);
7

7
while (true) {
01

01

01

01
01

01

01

01
int choice = [Link]();
10

10

10

if (choice == 1) {
10
24

24

24

24
[Link]();
String productName = [Link]();
double price = [Link]();
int quantity = [Link]();
[Link](productName, price, quantity);
} else if (choice == 2) {
double totalValue = [Link]();
[Link]("Total inventory value: $" + totalValue);
} else if (choice == 3) {
break;
7

} else {
01

01

01

1
10
01

01

01

[Link]("Invalid choice. Please select a valid option


0
10

10

10

10

(1/2/3).");
24

24

24

24
24 24 24 24
10 10 10 10

}
01 01 01 0

}
01 01 01 10
7 7 7 } 17
}

Status : Correct
[Link]();

24 24 24 24
10 10 1 00 10
01 01 10 01
01 01 01
7 7 17 7

24 24 24 24
10 10 10 10
01 01 01 01
01 01 01 01
7 7 7 7

24 24 24 24
10 10 10 10
Marks : 10/10

0 10 01 01 01
1 01 0 01
7 7 17 7
17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
2028_REC_OOPS using Java_Week 7_Q5

Attempt : 1
Total Mark : 10
Marks Obtained : 10

Section 1 : Coding

1. Problem Statement
7

7
01

01

01

01
Raj is curious about how old he is in the current year.
01

01

01

01
10

10

10

10
24

24

24

24
He has asked you to create a simple program that calculates a person's
age based on their birth year. You decide to implement this functionality
using the AgeCalculator interface and the HumanAgeCalculator class.

Note: The current year is 2024. Calculate the current age by using the
formula: current year - birth year.

Input Format
The input consists of an integer representing the birth year.
7

7
01

01

01

1
10

Output Format
01

01

01

0
10

10

10

10
24

24

24

24
The output displays "You are X years old." where X is an integer representing the
17

7
01

01

01
calculated age based on the entered birth year.
10

01

01

01
0
10

10

10

10
24

24

24

24
Refer to the sample output for formatting specifications.
Sample Test Case
Input: 1934
Output: You are 90 years old.
Answer
import [Link];
7

17

17
01

01
10

0
01

01

01
interface AgeCalculator{
00
10

10

10
1

int calculateAge(int birthYear);


24

24

24

24
}

class HumanAgeCalculator implements AgeCalculator{

@Override
public int calculateAge(int birthYear){
return (2024-birthYear);
}
}
class AgeCalculatorApp {
7

7
01

01

01

01
public static void main(String[] args) {
01

01

01

01
10

10

10

10
Scanner scanner = new Scanner([Link]);
24

24

24

24

AgeCalculator ageCalculator = new HumanAgeCalculator();

int birthYear = [Link]();


int age = [Link](birthYear);

[Link]("You are " + age + " years old.");


}
}

Status : Correct Marks : 10/10


7

7
01

01

01

1
10
01

01

01

0
10

10

10

10
24

24

24

24
17 Rajalakshmi Engineering College

7
01

01

01
10

01

01

01
0
10

10

10

10
Name: Arul Amudhan G Scan to verify results
24

24

24

24
Email: 241001017@[Link]
Roll no: 241001017
Phone: 7397782797
Branch: REC
Department: IT - Section 3
Batch: 2028
Degree: B.E - IT
7

17

17
01

01
10

0
2024_28_III_OOPS Using Java Lab
01

01

01
00
10

10

10
1
24

24

24

24
REC_2028_OOPS using Java_Week 7_MCQ

Attempt : 1
Total Mark : 15
Marks Obtained : 8

Section 1 : MCQ

1. Which of the following statements about Java interfaces is true?


7

7
01

01

01

01
Answer
01

01

01

01
10

10

10

A class can implement multiple interfaces. 10


24

24

24

24

Status : Correct Marks : 1/1

2. What is the primary purpose of static methods in Java interfaces?

Answer
They allow an interface to provide helper methods without requiring an
implementing class.
7

Status : Correct Marks : 1/1


01

01

01

1
10
01

01

01

0
10

10

10

10
24

24

24

24
3. What is the output of the following code?
17

7
01

01

01
10

01

01

01
0

interface X {
10

10

10

10
24

24

24

24
default void show() {
[Link]("X's Default Method");
}
}

interface Y {
default void show() {
[Link]("Y's Default Method");
}
}
7

17

17
01

01
10

0
01

01

01
00

class Z implements X, Y {
10

10

10
1
24

24

24

24
public void show() {
[Link]("Z's Method");
}
}

public class Main {


public static void main(String[] args) {
Z obj = new Z();
[Link]();
}
7

7
01

01

01

01
}
01

01

01

01
10

10

10

Answer 10
24

24

24

24
Compilation Error
Status : Wrong Marks : 0/1

4. What is the output of the following code?

interface A {
default void show() {
[Link]("A's Default Method");
7

7
01

01

01

}
10
01

01

01

}
10

10

10

10
24

24

24

24
17

7
01

01

01
interface B {
10

01

01

01
0

default void show() {


10

10

10

10
24

24

24

24
[Link]("B's Default Method");
}
}

class C implements A, B {
public void show() {
[Link]();
}
}
7

17

17
01

01
public class Main {
10

0
01

01

01
00

public static void main(String[] args) {


10

10

10
1
24

24

24

24
C obj = new C();
[Link]();
}
}
Answer
Compilation Error
Status : Wrong Marks : 0/1
7

7
01

01

01

01
5. How do you call a static method from an interface MyInterface?
01

01

01

01
10

10

10

10
24

24

24

24
Answer
[Link](); (where obj is an instance of a class implementing
MyInterface)
Status : Wrong Marks : 0/1

6. If a class implements two interfaces that have the same default


method, what must the class do?
7

Answer
01

01

01

1
10
01

01

01

The class must override the method to resolve ambiguity.


10

10

10

10
24

24

24

24
Status : Correct Marks : 1/1
17

7
01

01

01
10

01

01

01
0
10

10

10

10
7. What happens when an implementing class does not override a default
24

24

24

24
method from an interface?

Answer
The class will not compile.
Status : Wrong Marks : 0/1

8. How can a class explicitly call a default method from an interface if


there is a naming conflict?
7

17

17
01

01
10

0
01

01

01
00
10

10

10
Answer
1
24

24

24

24
Using [Link]();
Status : Wrong Marks : 0/1

9. Which of the following statements is true regarding default methods in


Java interfaces?

Answer
Default methods cannot have a body in the interface.
7

7
01

01

01

01
01

01

01

01
Status : Wrong Marks : 0/1
10

10

10

10
24

24

24

24

10. What is the output of the following code?

interface A {
default void show() {
[Link]("A's Default Method");
}
}

class B {
7

7
01

01

01

1
10

public void show() {


01

01

01

0
10

10

10

10
24

24

24

24
[Link]("B's Method");
17

7
01

01

01
}
10

01

01

01
0

}
10

10

10

10
24

24

24

24
class C extends B implements A {
}

public class Main {


public static void main(String[] args) {
C obj = new C();
[Link]();
}
}
7

17

17
01

01
10

0
01

01

01
Answer
00
10

10

10
1
24

24

24

24
Compilation Error
Status : Wrong Marks : 0/1

11. What is the output of the following code?

interface MathOperations {
static int square(int x) {
return x * x;
}
7

7
01

01

01

01
}
01

01

01

01
10

10

10

10
24

24

24

24
public class Main {
public static void main(String[] args) {
[Link]([Link](5));
}
}
Answer
25
Status : Correct Marks : 1/1
7

7
01

01

01

1
10
01

01

01

12. Consider a class implementing an interface and extending a class,


10

10

10

10
24

24

24

24
both having a method with the same name. Which method gets called?
17

7
01

01

01
10

01

01

01
0

Answer
10

10

10

10
24

24

24

24
The method from the superclass
Status : Correct Marks : 1/1

13. Can a Java interface contain both default and static methods?

Answer
Yes, an interface can have both default and static methods.
Status : Correct Marks : 1/1
7

17

17
01

01
10

0
01

01

01
00
10

10

10
1
24

24

24

24
14. Which of the following is the correct way to declare an interface in
Java?

Answer
interface Vehicle { void start();}
Status : Correct Marks : 1/1

15. What is the output of the following code?


7

7
01

01

01

01
01

01

01

01
interface A {
10

10

10

static void display() { 10


24

24

24

24
[Link]("Static method in A");
}
}

class B implements A {
static void display() {
[Link]("Static method in B");
}
}
7

7
01

01

01

1
10
01

01

01

public class Main {


0
10

10

10

10
24

24

24

24
24 24 24 24
10 10 10 10

}
01 01 01 0

}
01 01 01 10
7 7 7 17

Answer

Status : Correct
[Link]();

Static method in B

24 24 24 24
10 10 1 00 10
01 01 10 01
01 01 01
7 7 17 7
public static void main(String[] args) {

24 24 24 24
10 10 10 10
01 01 01 01
01 01 01 01
7 7 7 7

24 24 24 24
10 10 10 10
Marks : 1/1

0 10 01 01 01
1 01 0 01
7 7 17 7

You might also like