Executable code:
import java.util.*;
import java.lang.*;
import java.util.concurrent.ThreadLocalRandom;//to generate random
numbers
public class CarpetBill{
public static void main(String []args){
Scanner scan= new Scanner(System.in);
//prompts the user to enter the data: first name, last name,
length, width and cost
System.out.println("Enter your first name:");
String firstname=scan.nextLine();
System.out.println("Enter your last name:");
String lastname=scan.nextLine();
System.out.println("Enter length of the room (feet) :");
int length=scan.nextInt();
System.out.println("Enter width of the room (feet) :");
int width=scan.nextInt();
System.out.println("Enter cost per square foot: ");
System.out.println();
double cost=scan.nextDouble();
//obtaining the ID by capitalizinb the first letter of first name
using touppercase function, adding it to substring of 5 characters
from last name and random number
String
ID=Character.toUpperCase(firstname.charAt(0))+lastname.substring(0,5
)+ThreadLocalRandom.current().nextInt(10,100);
//prints the data according to the format specified
System.out.println("CUSTOMER\n"+"Last name "+lastname+"\nFirst name
"+firstname+"\nID "+ID);
System.out.println();
System.out.println("MEASUREMENT\n"+"Length 0"+length+" feet\nWidth
0"+width+" feet\nArea "+length*width+" square feet");
//Area = length*width
System.out.println();
System.out.println("CHARGES\n"+"Description "+"Cost/Sq.Ft.
"+"Charges");
System.out.println("----------- "+"----------- "+"--------");
System.out.print("Carpet "+cost+" ");
//cost incurred is equal to cost per sq.ft*area
System.out.printf("$%.2f\n", cost*length*width);
//declaring the tax as final i.e. constant
final double tax=8.5;
System.out.print("Tax "+tax+"% ");
//calculating and printing the amount of tax
System.out.printf("0%.2f\n", cost*length*width*tax*0.01);
System.out.println(" --------");
//print the total amount
double total =cost*length*width+cost*length*width*tax*0.01;
System.out.printf("Total $%.2f\n",total);
}
}
sample input:
John
Smith
23
13
14.20
sample output:
Need to solve this program which will run exactly like sample run .. Thanks Project 2...
Flowchart 1: Create a flowchart for a program that calculates the total cost of carpeting a room. Assume that the room is rectangular. The data required for running the program will be the length of the room, the width of the room, and the cost per square yard of the carpet. When the user runs the program it must, in the following order: Prompt for the length of the room. Prompt for the width of the room. Prompt for the...
program language: python 3
Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem. Also to practice documenting functions. Degree of Difficulty: Moderate Your task is to compute the cost of renovating the flooring in a rectangular room. This includes replacing the carpet and and the baseboards. Your task is to write a Python program that calculates and the cost of the renovation. To accomplish this, you will need...
This is in c programming using functions in visual studios
Carpet Jolb A carpeting company wants to estimate what it will cost a customer to have a room carpeted. They can carpet 65 sq. ft. of room space in 4 hours, and they charge $25.00 per hour as their labor rate Write a program to ask the user for the length of the room (in inches) to be carpeted, the width of the room (in inches) to be carpeted, and...
I need a c++ visual basic program that will. Carpet Calculator. This problem starts with the FeetInches class that is provided in the course Content area on the assignment page for this week. This program will show how classes will interact with each other as data members within another class. Modify the FeetInches class by overloading the following operators which should all return a bool. <= >= != Next add a copy constructor to the FeetInches class and a multiply...
Design a modular program using pseudo-code which prompts a user for their first name, followed by their last name; then displays a "Hello" salutation which concatenates their first name with their last name. Sample output (user input shown in red): Please enter your first name: John Please enter your last name: Smith Hello, John Smith! Your program must include a main module and one function; this function prompts the user for either their first name or last name, using a...
I need a C++ program like this please! and please follow all instructions! Thanks so much! A menu-driven program with 3 choices: Names Rearranger, Number Validator, or Exit Menu Option 1: Name Rearranger: 1. Input ONE STRING from the user containing first name, middle name, and last name. ie, "John Allen Smith". USE THE GETLINE function. (Not cin) 2. Loop through the string and validate for a-z or A-Z or . If the name has any other characters, then ask...
c/c++
6 Using some of the library string handling functions Here, you are to read first and last names of a person and join the two into a full nmae. But you will have to check that the string full name has a 'room' for all these characters. In this problem, the maximum number of characters in the full name is 20 Initially allow a maximum number of 15 characters of first & last names (One name length may compensate...
.Need code for my java class !! Write a simple java program that uses loops. You may use ‘WHILE’ or ‘FOR’ or ‘DO-WHILE’ – you decide. The program should use a loop to compute the semester average for up to 5 students. In the loop the user will ask for a student name and their 3 test scores and add them up and divide the total by 3 giving the semester average. You will print out the student name and...
Write a program that prompts the user to enter a list of names. Each person's name is separated from the next by a semi-colon and a space (: and the names are entered lastName, firstName (i.e. separated by ',). Your program should then print out the names, one per line, with the first names first followed by the last names. A sample run of your program should look like Please enter your list of names: Epstein, Susan; St. John, Katherine;...
Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...