Need to a program in Java using if statements.
Suppose the WIFI of a client is not working and you were assigned to troubleshoot it. For your efforts, suppose you will be paid $20 for every action you take to try to fix it (regardless if the action taken fixes the problem or not). You will also need to ask the customer for a $10 deposit before you start your work. At the end of the troubleshooting process, the client will hand your payment (minus the deposit).
Using what you have learned in the lectures, create a flow chart with the logic needed to solve the problem.
Your flow chart must also:
Wrote the java code for you, any further doubts ask in comments:
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
// System.out.println("Hello World");
int deposit=10;
double money=0;
int tries=3;
while(tries>0){
//troubleshooting process done
money+=20;
tries--;
}
money-=deposit;
System.out.format("Amount needed for services: %.2f\n",money);
//ask client
System.out.println("Press 1 for regular and 2 for high speed router");
Scanner sc= new Scanner(System.in);
int router_type=sc.nextInt();
if(router_type==1) money+=50;
else if(router_type==2) money+=200;
System.out.println("Are you in the military? y/n");
//Scanner sc= new Scanner(System.in);
char is_military=sc.next().charAt(0);
if(is_military=='y'){
double mil_disc=(money*0.1);
money-=mil_disc;
System.out.format("The total amount you need to pay is %.2f$. You have military discount of %.2f$\n",money,mil_disc);
}
else if(is_military=='n'){
System.out.format("The total amount you need to pay is %.2f$\n",money);
}
}
}
Get Answers For Free
Most questions answered within 1 hours.