Answer: Hey dear student finds the solution of your query if you have any doubt feel free to ask. Thanks!!
1- Java Code
int num,num1,num2;
if(num>100)
{
num1 = 20;
num2 = 40;
}
2- Java Program TimeCalculator
import java.io.*;
import java.util.Scanner; //import packages
class TimeCalculator
{
public static void main(String []args)
{
int seconds,leftover = 0,minutes = 0; //variable declarations
Scanner sc = new Scanner(System.in); //Scanner object
System.out.println("enter number of seconds: ");
seconds = sc.nextInt(); //takes input for seconds from user
if(seconds>=60) //check if seconds greater than or equalto
60
{
minutes = seconds/60; //to get minutes
leftover = seconds%60; //to get seconds
}
System.out.println("Minutes: "+minutes); //print minutes
System.out.println("Leftover seconds: "+leftover); //print
leftover
}
}
3- Java Code
int varX,varY;
if(varY>150)
{
varX= 5;
}
else
{
varX = 10;
}
4- Java code
int num1,num2,num3;
if(num1<10)
{
num2 = 0;
num3 = 1;
}
else
{
num2 = -99;
num3 = 0;
}
5- Java program
import java.io.*;
import java.util.Scanner;
class Main
{
public static void main(String []args)
{
int length1,length2,width1,width2;
int area1,area2;
area1 = length1*width1;
area2 = length2*width2;
if(area1>area2)
{
System.out.println("Rectangle1 is greater");
}
else
{
System.out.println("Rectangle2 is greater");
}
}
}

EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement...
Assignment #1: Write a C++ Program. Consider the following program segment. // Name: Your Name // MU ID: Your ID // include statement (s) l using namespace statement int main() //variable declaration //executable statements // return statement a. Include the header files isotream. b. Include cin, cout, and endl. c. Declare two variables: numi, num2, num3, and average of type int. d. Assign 125 into numi, 28 into num2, and -25 into num3 e. Store the average of numi, num2,...
Question Five c++ Decision Structures and Boolean Logic 1. Write an if statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. 2. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. 3. Write an if-else statement that assigns 0 to the variable b if the variable a is less...
This is Visual Basics... Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns false to fever.* Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.*
I
need to run each questions also with the outputs print
1. 3.1 Write an if statement that assigns 0 to x when y is equal to 20. If (y == 20) X=0; 2. 3.2 Write an if statement that multiplies payRate by 1.5 if hours is greater than 40. If (hours > 40) payRate - payRate * 1.5; 3. 3.12 Write nested if statements that perform the following test: If amounti is greater than 10 and amount 2 is...
WRITE THIS PROGRAM IN JAVA CODING ONLY ! Program 1: In Order Using an IF/ELSE IF/ELSE structure, write a program that will prompt the user for three numbers and displays them in ascending order. First, the program will prompt the user for each of the three numbers. Next, find the smallest value of the three. Then decide which of the other two is the next smallest. Then have the program display the three numbers in ascending order. Be sure to...
Topics If/Else statement Description Write a program that determines the larger of the two numbers provided by the user. The program asks the user to enter a number. Then it asks the user to enter another but a different number. Then, it determines the larger of the two numbers and displays it to the user. (If the user happens to enter the two numbers the same, the program may report either of the two numbers as larger.) Requirements Do...
1. Write a statement that calls a function named showSquare, passing the value 10 as an argument. 2. Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int data type and areturn type of void. 3. Write the function prototype for a function called showScoreswith a parameter list containing four integer variables and a return type of void. 4. Look at the following function definition: double getGrossPay(int hoursWorked, double payRate)...
Write, compile, and test a class that displays your first name on the screen. Save the class as Name. Write, compile, and test a class that displays your full name, street address and city, on three separate lines on the screen. Save the class as Address. Write a java program which add two numbers and print the result on screen. Save the class as Add2. Write a java program which accepts two numbers from user multiply them and print the...
Please answer this python questions.Thank you! Question Two Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show the total pay at the end...
Small aircraft weight limit Write an if-else statement that assigns safetyCheck with 1 if the sum of passengerWeight and cargoWeight is less than or equal maxWeight. Otherwise, assign safetyCheck with 0. Ex: If passengerWeight is 200, cargoWeight is 100, and maxWeight is 500, then safetyCheck is assigned with 1. If passengerWeight is 300, cargoWeight is 275, and maxWeight is 500, then safetyCheck is assigned with 0. Function Save C Reset DI MATLAB Documentation 1 function safetyCheck = CargoLimit(passengerWeight, cargoweight) 2...