Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

TS:ADV JAVA : SKILL:2

Submitted by : Mara.Lokesh naganka sri prabhu surya sai.

ID:2000031385

SEC : 4 B

DATE : 06-08-21.

Problem: HELPING A CONFUSED STUDENT (Constructor chaining… Numbers)Ravi who is lazy


to do his homework given by his math teacher,always finds a way to escape his
punishments.After many escapes he finally caught to his principal who is ready to give him a
punishment.To test his knowledge in mathematics the principal randomly giving numbers for
addition (2,3,4) numbers they might be a combination of decimals and numbers -If 4 numbers are
given return the sum of first two and first three and four number’s sum-if 3 numbers are given
return sum of first two and three numbers sum-if two numbers are given return return sum of
two numbersAnd he asked to answer immediately.To give him confidence the principal will let
raviknow how many numbers are going to be there that has to be added.Use constructor
overloading and constructor chaining concept in java and help him by developing java code
effectively to solve his problemNOTE- use switch case INPUT:X-Case of many numbers to be
addeddecimals and numbers accordingly OUTPUT:Addition of 1sttwo,three and four given
numbers.

Screen shots:
OUTPUT:

You might also like