Question: 2. Write the following math formulas in Java. You will need to use methods from the Math class as well as nesting of methods and
2. Write the following math formulas in Java. You will need to use methods from the Math class as well as nesting of methods and parentheses to force the order of operations to correctly calculate the answer. Assume that all the variables in the formulas have already been declared and initialized.
a.
b.
c.
d.
e.
f. 
3. A bus holds 45 people. The school will only use a bus if they can fill it completely. The rest of the people will ride in vans. Write a program that will take in the number of people that are signed up to go on a field trip. Have the program print the number of busses necessary and then total number of people that will need to ride in vans.
4. Write true or false on the blanks in the program below to show the value of the boolean variable true_false as the program executes.
int i=5;
int j=6;
boolean true_false; _________
true_false=(j
true_false=(j>3); ________
true_false=(j
true_false=(i
true_false=(j
true_false=(6
true_false=(i!=j); ________
true_false=(i==j || i
true_false=(i==j && i
true_false=(i>j || true_false && j>=4); ________
true_false=(!(i
true_false=!true_false; ________
5. Explain why each of the declarations in the second list are wrong.
boolean gameOver = false; int 2beOrNot2be;
int students=50,classes=3; float price index;
double sales_tax; double lastYear'sPrice;
6. Explain why each of the declarations in the second list do not follow conventions for variable names.
int cadence=3, speed=55, int c=3,s=55,g=4;
gear=4; final double salesTax=.06;
final double SALES_TAX=.06; double gearratio=.05,Gear=4;
double gearRatio= 5;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
