a program to calculate Item's sale price 1) Ask user to enter the name of item e.g t-shirt 2) Ask user to enter the color of the shirt they want to buy 3) Ask user to enter the item's price e.g 10, 100, 200 4) Write a method to calculate discounted price 1) If item's price is more than or equal to 100, get 10% discount 2) Item's color must be 'blue' 3) Return discounted price 4) If less than 100 or not blue, no discount
Q: Write a program that reads the following information and prints a payroll statement: Employee’s name…
A: 1. Input All values 2. Calculate gross=hour_pay_rate*10 deduction=gross*0.20 state=gross*0.09…
Q: What does the following code display: int value = 41; System.out.printın ( "Incrementing value: " +…
A: Here, we have given the java code. We need to complete the whole code in order to extract the output…
Q: This program prompts the user to enter the current month, using 1 for January, 2 for February... or…
A: import java.util.*;public class Main{ static double January() { int[] arr = new…
Q: Write a program that prompts the user to enter four integer values and prints the largest value…
A: Below I have provided Java Programming. Also, I have attached the screenshot of the code and output…
Q: Create a program that calculates the interest on a loan. Console Interest Calculator Enter loan…
A: Algorithm: Start Create NumberFormat objects for the locale US to represent currency $ where one…
Q: This method will return a string that when printed out will display a triangle. Each row of the…
A: The below code is fully functional and is written keeping in mind the requirements mentioned in the…
Q: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
A: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
Q: Income Amount of tax Not over $750 $750-$2500 $2500-$5000 $5000-$8000 Over $8000 1% of income $7.5…
A: JAVA code for above: import java.io.*;import java.util.concurrent.ThreadLocalRandom; import…
Q: Suppose you want to deposit a certain amount of money into a savings account with a fixed annual…
A: The first three steps are to get the inputs from the user which are the annual interest rate Number…
Q: 3. What is the value of the price variable after the following code snippet is executed? int price…
A: If-else statements determine whether the if expression is true or false. If it is true, then the if…
Q: Practical quiz 2 Write a Java program that will ask the user for the number of rooms (including…
A: import java.text.DecimalFormat;import java.util.Scanner; public class RoomChargeMain { public…
Q: The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a…
A: code: //Room rent #include<iostream> using namespace std; int main() { double cost, tax_amt,…
Q: Create a program that calculates the interest on a loan. This program should make it easy for the…
A: This program will make use of Scanner class defined in java.util package used to take user specific…
Q: Input a number value for LEFT, RIGHT and X. If LEFT is greater than RIGHT, display the first ten…
A: Find the required code in java given as below and output :
Q: Test the following program for different values and identify the error. int main() { double…
A: I have given an answer in step 2.
Q: What will be the value of the variable x after the execution of the program? %#3include int main()…
A: Ans : The value of the variable x after execution of the program is : int main(){ int x; x…
Q: A. Write a program that asks the user to enter a number of seconds. • There are 86400 seconds in a…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Ask the user for a name and for a list of test scores. Show the number of tests taken and the…
A: Here I have taken input from the user for the name and then created a list to store the marks. Next,…
Q: Write a program that calculate electricity bill. The program prompts the user to enter the amount of…
A: As there is no programming language mentioned program is attempted in python langugae. user has to…
Q: Suppose you have a certain amount of money in a savings account that earns monthly interest, and you…
A: import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in…
Q: Create a program that calculates the interest on a loan. This program should make it easy for the…
A: According to the information given:- We have to follow the instruction to get the desired outcome
Q: Qustion 3. pow is a method in the a. Integer b. Double c. Math d. System Question 4. The keyword_…
A: Q3. Option (C) is correct option. Pow function is defined in library Math.
Q: An argument is expressed in English below. Sara is not excited. If Sara is not excited, then Sara…
A: Ans.) Sara is not excited == ~q If sara is not excited, than she will go to party== ~q --> r…
Q: Re- write the following program by using switch statement
A: Solution :
Q: The following formula gives the distance between two points, (x1, yl) and (x2, y2) in the Cartesian…
A: PROGRAM CODE: #include<iostream>#include<math.h>#include<iomanip>using namespace…
Q: Write a program that asks the user to enter the number of students, then enter the grades of these…
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the main function.…
Q: A car insurance company charges a base fee of BD 50 per year, plus the following fees for any…
A:
Q: QUESTION 18 Write a Java program that prompts the user to enter the monthly salary amount in Omani…
A: 1 rial=1000 baisa. input monthly salary multiply it with 1000 then it will be in baisa. end.
Q: Write a code snippet that reads a number and displays the square, cube, and fourth power with the…
A: As the question has asked about the math. Pow method, I have used Java program which has the math…
Q: Ask the user to enter a day of the week in 3 letters. * Respond with the meal plan for that day.…
A: PROGRAM: //Header file import java.util.Scanner; //Defining the class class WeeklyMeakPlan {…
Q: Declare fvar number :=null; svar number :=5; Begin goto > if fvar is null then >…
A: Declare fvar number :=null;//fvar=null svar number :=5;//svar=5 Begin goto…
Q: Write a program that will convert a decimal number to octal. Can’t use Integer.toOctalString method
A: ALGORITHM:- Divide the decimal number by 8 until it becomes 0. Save remainder after each division…
Q: Write an application that allows a user to enter any number of student quiz scores, as integers,…
A: import java.util.Scanner; import java.util.*; import java.util.Collections; class Main { public…
Q: there are three seating categories at a stadium. for a softball game, class A seats are $30, Class B…
A: Since no programming language is mentioned, I am using python. Code: print("Enter number of tickets…
Q: 10 % discount. If the user purchases butter and flour he will get 15% discount. Otherwise, there is…
A: import java.util.Scanner;public class MyClass { public static void main(String args[]) {…
Q: Bank Utara Malaysia (BUM) has decided to give dividend to its accournt hoklers at thie end ul 2021.…
A: Find the required code in C++ given as below and output :
Q: If the number of items bought is less than 5, then the shipping charges are $7.00 for each item…
A: Correct code Here shipping charges are $7.00 for each item, if the number of items is less than 5.…
Q: Using C# write a program that computes the amount of money the computer club will receive from…
A: using System; namespace AmountCalculator { class calculateEarnings { public double…
Q: Write a program that prompts the user to enter the number of study hours of a student and the…
A: Algorithm Start Var h, n Accept n from user Accept h from user If(n>=4 and h<26), go to step…
Q: Use an IPO chart to create the logic for a program that continuously prompts a user for a numeric…
A: A C program for the given criteria is as follows, File name: “main.c” #include <stdio.h> int…
Q: A software company sells a package that retails for $99. Quantity discounts are given according to…
A: Programming instructions: Include necessary header files. Create a class. In the main, create the…
Q: Write a program (use value returning method) that gives simple math quizzes. The program should…
A: Given: Write a program (use value returning method) that gives simple math quizzes. The program…
Q: ate the amount that you will have after a specific number of months. The formula is: F=P x (1 + i)^t…
A: The given problem is related to calculating the future value of a saving account where the user…
Q: What should be printed on screen? int main() int x = 5; if(x++ == 5) cout<<"Five"<<endl; else if(++x…
A: The output of the given C++ code is: Five Therefore, the correct option is D. Five.
Q: Assume you are working as a developer in a bank, and you have been asked to develop a program to…
A: A flowchart is a diagrammatic representation of the flow of an algorithm. It consists of various…
Q: Given an airplane's acceleration and take-off speed v, you can compute the minimum runway length…
A: The given problem can be solved using simple arithmetic operations in any programming language.…
Q: Write an application that asks a user to enter an integer. Display a statement that indicates…
A: The code should start with asking the user to enter the integer followed by an if else loop that…
Q: write a console program that computes the amount of money the computer club will receive from…
A: Given that, write a console program that computes the amount of money the computer club will receive…
Q: By using loop and random method write java program to generate and print 10 integer numbers (“range…
A: Given: By using loop and random method write java program to generate and print 10 integer numbers…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images
- Financial Application:• Write a program that computes future investment value at a given interest rate for aspecified number of months and prints the report shown in the sample output. • Given the annual interest rate, the interest amount earned each month is computedusing the formula: Interest earned = investment amount * annual interest rate /1200 (=months * 100) • Write a method, computeFutureValue, which receives the investment amount, annualinterest rate and number of months as parameters and does the following: o Prints the interest amount earned each month and the new value of theinvestment (hint: use a loop). o Returns the total interest amount earned after the number of months specified bythe user. The main method will:o Ask the user for all input needed to call the computeFutureValue method.o Call computeFutureValueo Print the total interest amount earned by the investment at the end of thenumber of months entered by the user. Sample Program runningEnter the investment…Write a program to calculate item’s sale priceAsk user to enter the name of item e.g t-shirtAsk user to enter the color of the shirt they want to buyAsk user to enter the item’s price e.g 10, 100, 200Write a method to calculate discounted priceIf item’s price is more than or equal to 100, get 10% discountItem’s color must be ‘blue’ Return discounted price If less than 100 or not blue, no discount Mainline should display, item name, color and the discounted priceDetermine whether each statement below is true or false. Assume no index is out of bounds. Write either "true" or "false" on each line. Note: The Math.random() method returns a pseudorandom double type number greater than or equal to 0.0 and less than 1.0. int[] a = new int[6]; int[] b = new int[6]; int[] c = a; c[0] = 3;
- 1. Create a new program called LetterGrade. Prompt the user to enter their name. Create a method called calculateAvg. Method should use a cumulative sum loop to prompt the user to enter 3 scores and calculate the average. Then, return that value to main. 2. Once the average is returned, Print the student's name and their average using printf command. Create another method called printLetter. Method should pass a parameter (average grade). Use if…else if…else statements to print whether the student has an ‘A’, ‘B’, ‘C’, ‘D’, or ‘F’ average grade. Grade Scale: 90-100 - A 80-89 - B 70-79 - C 60-69 - D 0-59 - FA. Write a program that asks the user to enter a number of seconds.• There are 86400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds.• There are 3600 seconds in an hour. If the number of seconds entered by the user is less than 86400, but is greater than or equal to 3600, the program should display the number of hours in that many seconds.• There are 60 seconds in a minute. If the number of seconds entered by the user is less than 3600, but is greater than or equal to 60, the program should display the number of minutes in that many seconds.B. Write a function named biggest that receives three integer arguments and returns the largest of the three values.(Find future dates) Write a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, …, and Saturday is 6). Also prompt the user to enter the number of days after today for a future day and display the future day of the week.
- Retail price calculator Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It should then display the item’s retail price. For example: • If an item’s wholesale cost is 5.00 and its markup percentage is 100 percent, then the item’s retail price is 10.00.• If an item’s wholesale cost is 5.00 and its markup percentage is 50 percent, then the item’s retail price is 7.50. The program should have a method named calculateRetail that receives the wholesale cost and the markup percentage as arguments and returns the retail price of the item.Question # 4: Write a program that calculates the electricity bill. The rates of electricity per unit are as follows: If the units consumed are 300 and 8 2000 2750 Question # 6: Write a program that converts the angle from degree to radian and displays each value.a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.
- OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and tax rate. INPUT: his/her name, pay rate, and number of hours. You will prompt the user with a friendly message to enter the employee’s name, pay rate and number of hours. Note that you must use the dash (-) to connect the first name to the last name so that the name can be read using the cin statement. For example, John-Doe OUTPUT: the employee’s gross pay, tax deduction, and net pay. For example: Name: John-Doe Your gross pay is: 900.00 Your tax deduction is: 90.00 Your net pay is: 810.00 METHOD: the gross pay is the pay rate times the number of hours. The tax deduction is computed as follows: If the gross pay is less than 1000.00, it is 10% of the total pay; otherwise, it is 15% of the gross pay. The net pay is the gross pay minus the tax deduction. TOPICS:…Write a complete program to calculate the value of dollars and cents represented by coins. Your program should accomplish these steps, in order: Part One: Generate the Number of Coins use the Random's nextInt(int) method to generate a random number that represents the number of quarters, dimes, nickels, and pennies there should be at least one of each coin and a max of: 20 quarters, 50 dimes, 100 nickels, and 500 pennies output the number of each coin to the user Part Two: Calculate the Value declare constants to represent the value of each coin note: declare the constants outside of the main method (but inside the class) and declare as: public static final datatype NAME = ...; use arithmetic expressions to calculate how much total dollars and cents are represented by the coins output the total value so that it always displays two decimal points Part Three: Quarters Give-Away ask the user how many people will be given quarters use division and modulus to calculate how many…What is the output of the following code? def main(): x = do_something(3) y = do_something(x) print(x + y) def do_something(a): x = a - 1 b = a * 2 return b main()