write the programs:-
i)WAP to input the three sides of a triangle, Check if the triangle is possible and display the type of
triangle it is
(ii)WAP to input three subjects mark,calculate the average and print the result as per the conditions
given
Average
Results
avg greater than equal to 60 1st division
avg 51 to 60 2nd division
avg 40 to 50 3rd division
below 40 fail
(iii)The electric board charges their consumers according to the number of units consumed per
month.The amount is calculated as per the units consumed is given below
units consumed
charges
upto 100 units
5.50 per unit
for next 200 units
6.50 per unit
for next 300 units
7.50 per unit
more than 600 units
8.50 per unit
WAP to input the units consumed and calculate and display the amount to be paid by the customer.
Answers
Prog 1)
import java.util.Scanner;
public class tri
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a, b, c;
System.out.println("Enter your values of tri to check");
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
if((a+b>c)&&(b+c>a)&&(c+a>b))
{
System.out.println("Triangle is possible");
if(a==b&&a==c&&b==c)
System.out.println("Triangle is Equilateral");
else if(a==b||b==c||c==a)
System.out.println("Triangle is Isosceles");
else if(a!=b&&b!=c&&c!=a)
System.out.println("Triangle is Scalene");
}
else
System.out.println("Triangle not possible");
}
}
Prog 2)
import java.util.Scanner;
public class mark
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int physics, math, computer, avg;
System.out.println("Enter your marks");
physics=in.nextInt();
math=in.nextInt();
computer=in.nextInt();
avg=physics+computer+math/3;
if(avg>=60)
{
System.out.println("1st Divison :"+avg);
}
else if(avg>51&&avg<60)
{
System.out.println("2nd Division :"+avg);
}
else if(avg>40&&avg=<50)
{
System.out.println("3rd Division :"+avg);
}
else if(avg<40)
{
System.out.println("Fail :"+avg);
}
}
}
Prog 3)
import java.util.Scanner;
public class bill
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
double sum=0.0; String name=""; int b=0;
System.out.println("Input the units consumed");
b= in.nextInt();
if(b>100)
{
sum=b*5.50;
}
else if(b>200)
{
sum=b*6.50;
}
else if(b>300)
{
sum=b*7.50;
}
else if(b>600)
{
sum=b*8.50;
}
System.out.println("The units consumed :" +b);
System.out.println("The total bill :" +sum);
}
}
MAINE BAHUT MEHANT KI HAI, PLEASE MERE ANSWER KO BRAINLIEST BANAO PLEASE
I HAVE DONE A LOT OF HARDWORK IN MAKING OF THESE PROGRAMS AND IT TOOK MANY HOURS SO PLEASE MARK MY ANSWER AS BRAINLIEST, PLEASE
HOPE YOU LIKED MY ANSWER:)