Assignment 8 Design an application that ask the user for an
Solution
HI, You have not mentioned about programming language.
Please try to mention each details.
I have implemented in Java.
public class App{
// Assignment 8
public static void assignment8(int x){
if(x%5 == 0)
System.out.println(\"divisible by 5\");
else
System.out.println(\"Not divisible by 5\");
}
//Assignment 9
// Precondition :x and y shouldbe in range 1-9
public static void assignment9(int x, int y){
if(x*y > 50)
System.out.println(\"Product is greater than 50\");
else
System.out.println(\"Product is not greater than 50\");
}
//Assignment 10
// Precondition: x and y should be in range 1-9
public static void assignment10(int x, int y){
if(x > y)
System.out.println(\"first is greater than second\");
else if(x < y)
System.out.println(\"first is lesser than second\");
else
System.out.println(\"first and second are equal\");
System.out.println(\"multiplication of square of first and second: \"+(x*x * y*y));
}
//Assignment 10
// Precondition: x should be in range 0-29
public static void assignment11(int x){
if(x >=0 && x <=9)
System.out.println(\"input is in range 0 -9\");
else if(x>=10 && x <=19)
System.out.println(\"input is in range 10 -19\");
else if(x>=20 && x>=29)
System.out.println(\"input is in range 20 -29\");
}
public static void main(String[] args) {
assignment8(15);
assignment9(4, 7);
assignment10(2, 8);
assignment11(18);
}
}
/*
Sample run:
divisible by 5
Product is not greater than 50
first is lesser than second
multiplication of square of first and second: 256
input is in range 10 -19
*/



