1. Write pseudocode and java code for following definition: Write a program that
ID: 3753454 • Letter: 1
Question
1. Write pseudocode and java code for following definition:
Write a program that reads three edges for a triangle from user and determines whether the input is valid or not. The input is valid if the sum of any two edges is greater than the third edge. Print appropriate message according to input values
2.
Design the decision table for the new recruit in IT firm.
The HR Manager of a popular IT firm has decided to recruit new talent into their organization based on a predefined set of criteria:
Those who have a Diploma in Computer Studies, with knowledge of hardware and experience in software development, will be assigned to the Systems Group.
Those who have a Diploma in Computer Studies, with experience in software development, will be assigned to the Programming Group.
Those who have a Diploma in Computer Studies, with knowledge of hardware, will be assigned to the Operations Group.
Those who have knowledge of hardware and experience in software development will be assigned to the Operations Group.
All other candidate will be rejected.
Draw a complete limited entry decision table that would satisfy the above criteria
Identify any possible simplifications for the decision table and create a simplified version of it
3.
Simplify or prove each of the following statements, using the laws and theorems.
(A + B) * (A + C) = A + B*C
A + (~A*B) = A+B
[ A * (~A + B)] * C = A * B * C
[(~A * (B + C)] + (A * B) = B + ~A * C
A+A*B=A
A * B + A * ~B = A
[(A + B) * A] * (A + B) = A
(~P*(P+~Q)) * ~Q
~P+(Q*R)+(~P+Q)
(~P+Q)*(~P+Q)
(P+~Q)*(P+R)
Explanation / Answer
1)
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Vamsi
*/
public class Triangle {
public static void main(String argv[])
{
//variable delarations
double e1,e2,e3;
//to readinput
Scanner sc = new Scanner(System.in);
//reading triangle edges
System.out.print("Enter edge 1:");
e1=sc.nextDouble();
System.out.print("Enter edge 2:");
e2=sc.nextDouble();
System.out.print("Enter edge 2:");
e3=sc.nextDouble();
//finding triangle or not
//if the sum of any two edges is greater than the third edge
if(e3<(e1+e2))
{
System.out.println("Yes! given edges form triangle---");
}
else if(e2<(e1+e3))
{
System.out.println("Yes! given edges form triangle---");
}
else if(e1<(e3+e2))
{
System.out.println("Yes! given edges form triangle---");
}
else
{
System.out.println("No! given edges do not form triangle---");
}
}
}
//if any problem with the code //comment below
output:
run:
Enter edge 1:5
Enter edge 2:2
Enter edge 2:3
Yes! given edges form triangle---
BUILD SUCCESSFUL (total time: 9 seconds)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.