Computers and Technology

What is the problem in this program; class Main {
public static void main(String[] args) {
String userChoice;

String userName;

double hrsWorked = 0;
double payRate = 0.00;
double taxRate1 = 0.25;
double taxRate2 = 0.50;

double grossPay = 0.00;
double taxAmt = 0.00;
double netPay = 0.00;

scanner in = new scanner( System. in );

System. out. println("Please enter your first name ==> \n");
userName = in. next();

System. out. println("Do you want to compute your net pay? \n");
System. out. println("Enter Y for yes or N for no ==> ");
userChoice = in. next();

if (userChoice. equals("Y")) {
System. out. println("\n Please enter the number of hours you worked ==>");
hrsWorked = in. nextInt();

System. out. println("\n Please enter your pay rate ==> $");
payRate = in. nextFloat();

grossPay = payRate * hrsWorked;

taxAmt = (grossPay >= 500) ? grossPay * taxRate2 : grossPay * taxRate1;

netPay = grossPay - taxAmt;

System. out. println( "\n " + userName + " you said you worked " + hrsWorked + " hours at $" + payRate + "\n");
System. out. println("which means you earned a gross amount of $" + grossPay + " \n");
System. out. println("and you paid $" + taxAmt + " in taxes\n");
System. out. println("so your net pay is $" + netPay + " \n");}
else {System. out. println("\n Thank you " + userName + " then I will not computer your net pay \n");
System. out. println(" Thank you and please come again. \n");
}
}
}
also, this done repl. it PLEASE HELP ASP

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 18:30, HavenShort3075
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 1
image
Computers and Technology, 24.06.2019 21:30, keelynnbarrier
Computer security/cybersecurity1) each of the following code fragments contains a number of security vulnerabilities. for each fragment, identify these security vulnerabilities and, for each vulnerability, discuss at least one way that it could be improved. note that in your discussion of how each vulnerability could be improved, you do not need to re-write a new version of the program in c; simply discuss your solution, either in pseudocode or in 1-2 sentences. a) /* file descriptor leak */#include #include int main(int argc, char *argv[]){ char *filepath = argv[0]; char *shellpath = argv[1]; file *passwords; passwords = fopen(filepath, "r"); /* read the password and do something with it */ /* . . */ /* fork and execute alternative shell */ execl(shellpath, "shell", null); }b)#include /* assume the following function is written for an electronic storefront. the user will enter the id of the item to be ordered, as well as the quantity of units that they would like to purchase. the program will then lookup the price for the price for the item using a predefined function, and return the total cost of the order.*/int gettotalcost(){ char itemid[9]; int price, unitsordered, cost; printf(" enter the 9-digit id of the item to be ordered: "); scanf("%s", & itemid); /* lookup the price according to the itemid */ price = getpricebyid(itemid); printf(" enter the quantity of units to be ordered: "); scanf("%d", & unitsordered); cost = price * unitsordered; return cost; }c)#include /* the following function is intended to return a user's full name by concatenating the user's first and last name into a single string and then returning that string. */char *getfullname(char *firstname, char *lastname, int max_len){ char fullname[max_len]; strcpy(fullname, firstname); strcat(fullname, " "); strcat(fullname, lastname); return fullname; }d)#include /* the following code snippet runs through the list of cli arguments entered and displays them to the console. */int main(int argc, char *argv[]){ int i; printf("you've entered the following arguments: "); for(i = 0; i < argc; i++){ print(argv[i]); printf("\n"); } /* */}
Answers: 2
image
Computers and Technology, 24.06.2019 23:00, amandajennings01
Why is it preferable to code web pages in html format? a. to create more lines code b. to apply general formatting rules c. to display properly as search results in all browsers d. to add meaning to the document
Answers: 1
image
Computers and Technology, 25.06.2019 05:30, 19jcormier
You are asked to calculate an object's velocity, in order to do so you must know the object's a. direction and speed. b. distance and time. c. speed and distance. d. direction and distance.
Answers: 1
Do you know the correct answer?
What is the problem in this program; class Main {
public static void main(String[] args) {

Questions in other subjects:

Konu
History, 09.05.2021 22:00
Konu
Mathematics, 09.05.2021 22:00
Konu
Mathematics, 09.05.2021 22:00