Homework 4
Put all home works together and use methods to simplify code. Also expand to have preferences and budget for wall coverings the way that was done for floor options
Use separate Methods to calculate the change for each the Door, Window and Bookcase (Hint – you may want to use 2 methods for the book case effects since one is floor and other is wall).
The user shall input the dimensions of the room and the eventual output will be how the walls and flooring is done and how much budget is left.
The user will input the number of doors, windows, and bookcases and the dimensions of each which will be used to adjust the total wall and floor space needed to be covered. The system will output the square feet of wall and floor after adjustments.
The user will be asked for his budget for the walls and if he has a preference for the type of material for the wall. The system will accept as input the costs for the different wall coverings and determine which wall covering the user can afford – being either his preference or the most expensive if he does not have a preference. It’s also possible the user can not afford any wall coverings. The budget left after the wall covering is kept for how much money is left.
The system will output the initial budget for walls, the selected option and cost and what is left in the budget for walls.
The same process will work for floor coverings with the same output for flooring.
YOU also have COST OPTIONS FOR WALLS, A USER PREFERENCE AND A BUDGET, YOU WILL DO THE SAME FOR THE WALL. SAME RULES APPLY – IF 0 THEN JUST PICK MOST EXPENSIVE, IF PREFERENCE GIVE PREFERENCE IF CAN AFFORD, IF NOT GIVE WHAT CAN AFFORD.
There are four options for wall cover (Ceramic Tile = 1; Paneling = 2, Wallpaper = 3; and paint = 4) each with a cost per square foot The program will ask for input and read in the budget in dollars and cents, the cost per square foot for each of the different wall options and also ask for which one the customer prefers where 0 means the customer does not care and 1-4 if they have a specific preference.
Output the users preference, their budget, if they got their preference, and what they did get. Also how much budget is left.
You will be graded on how well you map this to methods and how good the comments are explaining what the program does.
Use the following for data (it is the same as HW 3 so you should get the same selection answers for flooring as you get there.
· First renovation project (THREE DOORS, ONE BOOKSHELF, NO WINDOWS)
o Room is 12 feet long, 12 feet wide, and 12 feet high
o Door 1 is 2 feet wide by 10 feet high
o Door 2 is 3 feet wide by 5 feet high
o Door 3 is 3 feet wide by 5 feet high
o Bookshelf is 8 feet long by 10 feet high by 2 feet deep
o No windows
· Second renovation project (3 WINDOWS, 2 BOOKSHELFS, NO DOORS)
o Room is 24 feet long, 12 feet wide, and 8 feet high
o Window 1 is 2 feet wide by 6 feet high
o Window 2 is 3 feet wide by 5 feet high
o Window 3 is 8 feet wide by 5 feet high
o Bookshelf 1 is 8 feet long by 6 feet high by 3 feet deep
o Bookshelf 2 is 3 feet long by 6 feet high by 2 feet deep
o No doors
· Third renovation project (ONE DOOR, 2 WINDOWSS, ONE BOOKSHELF)
o Room is 12.75 feet long, 11.25 feet wide, and 12 feet high
o Door is 1.95 feet wide by 10 feet high
o Window 1 is 2.5 feet wide by 5 feet high
o Window 2 is 6.8 feet wide by 7.2 feet high
o Bookshelf is 8 feet long by 6 feet high by 3 feet deep
For Flooring use:
Tile= $4.00 /sq ft; Wood = $3.00/ sq ft; Carpet = $2.00/ sq ft and linoleum = $1.00/sq ft).
Use the following as the budget and preference:
Budget/preference |
Renovation 1 |
Renovation 2 |
Renovation 3 |
User preference |
0 |
1 |
3 |
Budget |
255.00 |
250.00 |
400.00 |
There are four options for wall cover (Ceramic Tile = 1; Paneling = 2, Wallpaper = 3; and paint = 4) each with a cost per square foot
For all three test renovation projects use Tile= $4.00 /sq ft; Paneling = $3.00/ sq ft; Wallpaper = $2.00/ sq ft and paint = $1.00/sq ft).
Use the following as the budget and preference:
Renovation 1 |
Renovation 2 |
Renovation 3 |
|
User preference |
0 |
4 |
3 |
Budget |
1200.00 |
250.00 |
6000.00 |
hw 3
package lab;
import static java.lang.System.*;
import java.util.Scanner;
// Renovation Project
public class hw3 {
{
}
public static void main(String args[]) {
double rheight, rwidth, rlength; //room height,width and length
variabe
int numberOfDoors,numberOfWindows,numberOfBookCases=0;
double dheight=0, dwidth=0; //door height and width variable
double w1height, w1width;//window1 height and width variable
//double w2height, w2width;//window2 height and width
variable
double bheight, bwidth, blength;//bookshelf height ,length and
width variable
double paintArea, carpentArea, floorArea;
double paintCost, carpentCost = 0, floorCost, budget;
int preferences = 0;
String flooring = "";
Scanner s = new Scanner(System.in);
out.print("Enter the Room height : ");
rheight = s.nextDouble();
out.print("\nEnter the Room width : ");
rwidth = s.nextDouble();
out.print("\nEnter the Room length : ");
rlength = s.nextDouble();
//Taking number of Rooms as input
out.print("Enter the Number of Doors: ");
numberOfDoors=s.nextInt();
double totalDoorSize=0;
//calculate total size of doors by iterating over number of
doors
for(int i=1;i<=numberOfDoors;i++){
out.print("\nEnter the Door"+i+" height : ");
dheight = s.nextDouble();
out.print("\nEnter the Door"+i+" width : ");
dwidth = s.nextDouble();
totalDoorSize=totalDoorSize+(dheight*dwidth);
}
//Taking number of Windows as input
out.print("Enter the Number of Windows: ");
numberOfWindows=s.nextInt();
double totalWindowSize=0;
//calculate total size of doors by iterating over number of
windows
for(int i=1;i<=numberOfWindows;i++){
out.print("\nEnter the Window"+i+" height : ");
w1height = s.nextDouble();
out.print("\nEnter the Window"+i+" width : ");
w1width = s.nextDouble();
totalWindowSize=totalWindowSize+(w1height*w1width);
}
//Taking number of Bookcases as input
out.print("Enter the Number of Bookcases: ");
numberOfBookCases=s.nextInt();
double totalBookCasesCarpetArea=0,totalBookCasesPaintArea=0;
//calculate total size of doors by iterating over number of
bookcase
for(int i=1;i<=numberOfBookCases;i++){
out.print("\nEnter the bookshelf"+i+" height : ");
bheight = s.nextDouble();
out.print("\nEnter the bookshelf"+i+" width : ");
bwidth = s.nextDouble();
out.print("\nEnter the bookshelf"+i+" length : ");
blength = s.nextDouble();
totalBookCasesCarpetArea=totalBookCasesCarpetArea+(bwidth*blength);
totalBookCasesPaintArea=totalBookCasesPaintArea+(bheight*blength);
}
//Commenting out hard coded values for number of doors,window and
bookcases
/*out.print("\nEnter the Window1 height : ");
w1height = s.nextDouble();
out.print("\nEnter the Window1 width : ");
w1width = s.nextDouble();
out.print("\nEnter the Window2 height : ");
w2height = s.nextDouble();
out.print("\nEnter the Window2 width : ");
w2width = s.nextDouble();*/
/* out.print("\nEnter the bookshelf height : ");
bheight = s.nextDouble();
out.print("\nEnter the bookshelf width : ");
bwidth = s.nextDouble();
out.print("\nEnter the bookshelf length : ");
blength = s.nextDouble();*/
out.print("\nEnter the painting cost per square feet: $");
paintCost = s.nextDouble();
// out.print("\nEnter the carpenting cost per square feet:
$");
// carpentCost = s.nextDouble();
out.print("\nChoose Flooring type : \n0: No Preferences\n1: Ceramic
Tile \n2: Hardwood \n3: Carpet \n4: linoleum tile \n Enter Flooring
type : ");
preferences = s.nextInt();
out.print("\nEnter your budget for flooring: ");
budget = s.nextDouble();
paintArea = 2 * rheight * (rwidth + rlength) -
(totalBookCasesPaintArea) - (totalWindowSize) - (totalDoorSize);
//calculation of paint area
carpentArea = (rwidth * rlength) - (totalBookCasesCarpetArea);
//calculation of carpent area
/*paintArea = 2 * rheight * (rwidth + rlength) - (bheight *
blength) - (w1width * w1height) - (w2width * w2height) - (dheight *
dwidth); //calculation of paint area
carpentArea = (rwidth * rlength) - (bwidth * blength);
//calculation of carpent area
*/ switch (preferences) {
case 0:
if (4 * carpentArea <= budget) {
carpentCost = 4;
flooring = "Ceramic Tile";
} else if (3 * carpentArea <= budget) {
carpentCost = 3;
flooring = "Hardwood";
} else if (2 * carpentArea <= budget) {
carpentCost = 2;
flooring = "Carpet";
} else if (1 * carpentArea <= budget) {
carpentCost = 1;
flooring = "Lenolieum Tile";
} else {
carpentCost = 0;
flooring = "";
}
break;
case 1:
if (4 * carpentArea <= budget) {
carpentCost = 4;
flooring = "Ceramic Tile";
} else {
carpentCost = 0;
}
break;
case 2:
if (3 * carpentArea <= budget) {
carpentCost = 3;
flooring = "Hardwood";
} else {
carpentCost = 0;
}
break;
case 3:
if (2 * carpentArea <= budget) {
carpentCost = 2;
flooring = "Carpet";
} else {
carpentCost = 0;
}
break;
case 4:
if (1 * carpentArea <= budget) {
carpentCost = 1;
flooring = "Lenolieum Tile";
} else {
carpentCost = 0;
}
break;
}
out.println("Area of wall after removing the paining area : " +
paintArea);
out.println("Area of floor after removing area of bookshelf : " +
carpentArea);
out.println("Cost for painting : $" + (paintArea *
paintCost));
if (carpentCost != 0) {
out.println("flooring type : " + flooring);
out.println("Cost for flooring : $" + (carpentArea *
carpentCost));
} else {
out.println("No Affordable flooring available in given
budget");
}
}
}
/*
Renovation1
Enter the Room height : 12
Enter the Room width : 12
Enter the Room length : 12
Enter the Number of Doors: 3
Enter the Door1 height : 10
Enter the Door1 width : 2
Enter the Door2 height : 5
Enter the Door2 width : 3
Enter the Door3 height : 5
Enter the Door3 width : 3
Enter the Number of Windows: 0
Enter the Number of Bookcases: 1
Enter the bookshelf1 height : 10
Enter the bookshelf1 width : 2
Enter the bookshelf1 length : 8
Enter the painting cost per square feet: $1
Choose Flooring type :
0: No Preferences
1: Ceramic Tile
2: Hardwood
3: Carpet
4: linoleum tile
Enter Flooring type : 0
Enter your budget for flooring: 255.00
Area of wall after removing the paining area : 446.0
Area of floor after removing area of bookshelf : 128.0
Cost for painting : $446.0
flooring type : Lenolieum Tile
Cost for flooring : $128.0
Renovation 2
Enter the Room height : 8
Enter the Room width : 12
Enter the Room length : 24
Enter the Number of Doors:
0
Enter the Number of Windows: 3
Enter the Window1 height : 6
Enter the Window1 width : 2
Enter the Window2 height : 5
Enter the Window2 width : 3
Enter the Window3 height : 5
Enter the Window3 width : 8
Enter the Number of Bookcases: 2
Enter the bookshelf1 height : 6
Enter the bookshelf1 width : 3
Enter the bookshelf1 length : 8
Enter the bookshelf2 height : 6
Enter the bookshelf2 width : 2
Enter the bookshelf2 length : 3
Enter the painting cost per square feet: $1.57
Choose Flooring type :
0: No Preferences
1: Ceramic Tile
2: Hardwood
3: Carpet
4: linoleum tile
Enter Flooring type : 1
Enter your budget for flooring: 250.00
Area of wall after removing the paining area : 443.0
Area of floor after removing area of bookshelf : 258.0
Cost for painting : $695.51
No Affordable flooring available in given budget
Renovation 3
Enter the Room height : 12
Enter the Room width : 11.25
Enter the Room length : 12.75
Enter the Number of Doors: 1
Enter the Door1 height : 10
Enter the Door1 width : 1.95
Enter the Number of Windows: 2
Enter the Window1 height : 5
Enter the Window1 width : 2.5
Enter the Window2 height : 7.2
Enter the Window2 width : 6.8
Enter the Number of Bookcases: 1
Enter the bookshelf1 height : 6
Enter the bookshelf1 width : 3
Enter the bookshelf1 length : 8
Enter the painting cost per square feet: $0.95
Choose Flooring type :
0: No Preferences
1: Ceramic Tile
2: Hardwood
3: Carpet
4: linoleum tile
Enter Flooring type : 3
Enter your budget for flooring: 400.00
Area of wall after removing the paining area : 447.04
Area of floor after removing area of bookshelf : 119.4375
Cost for painting : $424.688
flooring type : Carpet
Cost for flooring : $238.875
*/
Please write the code with comments for everything thank you! and don't use objects
In: Computer Science
(Java) Building a Doubly Linked List off of an interface I am
having trouble with these two methods
@Override public void add(T newEntry) { DoubleLinkedNode newNode = new DoubleLinkedNode(newEntry); if (!isEmpty()) { } if (isEmpty()) { first = newNode; last = newNode; } else { last.setNextNode(newNode); newNode.setPreviousNode(last); last = newNode; } // length++; numElements++; } @Override public void add(int newPosition, T newEntry) { DoubleLinkedNode newAdder = new DoubleLinkedNode(newEntry); if ((newPosition >= 0) && (newPosition <= numElements)) { numElements++; if (newPosition == 0) { add(newEntry); } else if (newPosition >= getLength() + 1) { DoubleLinkedNode previousNode = getNodeAt(newPosition - 1); DoubleLinkedNode NextNode = previousNode.getNextNode(); newAdder.setNextNode(NextNode); newAdder.setPreviousNode(previousNode); previousNode.setNextNode(newAdder); NextNode.setPreviousNode(newAdder); } else if (newPosition == getLength()) { DoubleLinkedNode previousNode = getNodeAt(newPosition - 1); previousNode.setNextNode(newAdder); newAdder.setPreviousNode(previousNode); last = newAdder; } } else { throw new IndexOutOfBoundsException(""); } } I cannot figure out how to get the add newEntry and other add method to work All the Method calls do what you'd think they'd do
In: Computer Science
Q. An Operating system is an intermediary agent between the user and the computer hardware. Explain !
In: Computer Science
What volume, in milliliters, of 0.160 M0.160 M NaOH NaOH should be added to a 0.140 L0.140 L solution of 0.021 M0.021 M glycine hydrochloride (pKa1=2.350,Ka1=2.350, pKa2Ka2 = 9.7789.778) to adjust the pH to 2.61?
In: Chemistry
(java)
Create a specification(your choice) of a data abstraction , decide a rep for the data abstraction. Write the abstraction function and the rep invariant for the rep.
Note* add comments for explanation..
In: Computer Science
A data structure can be defined as a mechanism for organizing the data a program stores in memory. An example of a data structure is a Linked List. Discuss how a linked list works and the methods of this data structure. (Please be super detailed and type the solution)
In: Computer Science
Cassi Cronin is the Women’s head varsity hockey coach at USGB University. She has enjoyed considerable success over the years and is considering starting a summer hockey camp. USGB University would charge Coach for rooms, meals and ice-rink time for participants, plus a 10% commission based upon the price charged to campers. Coach Cassi has heard of the CVP experts in Acct 2220 and is asking for your help (and she is willing to pay!). You state that some of the important factors in analyzing such an opportunity involve setting fees, predicting enrollments and estimating the behavior of costs. Accordingly, planning ahead involves estimates and assumptions. Coach has provided estimates as follows:
Expected/Planned enrollments each week |
90 campers |
Average price to be charged for one-week of camp |
$225 per camper |
Estimated Costs: |
|
Asst coaches’ salaries |
$550 per coach per week |
Campus food/dining for campers |
$40 per camper |
Health insurance and fancy USGB T-shirts |
$15 per camper |
Room rent charged by university |
$28 per camper |
Ice Arena & locker room charge (by University) |
$2,000/week, plus 10% of camper fee |
Admin, marketing brochures, mailings, etc. |
$2,700 for each week |
Coach Cassi states that other camps have typically employed one assistant coach for each 15 campers, excluding the director (Cassi in this case). One problem is that you need to hire the coaches before you know the enrollments, although it is usually possible to find one or two at the last minute. It is, however, important to hire most of the assistant coaches early so you can use their names in the marketing brochures. Further, while the enrollment and prices given are averages, variations exist, with enrollments generally ranging from 60 to 110 and weekly camper fees ranging from $160 to $330. As might be expected, the better-known camps have higher enrollments at higher prices, but they also pay more for more well-known coaches. Coach Cassi will keep any profits (or suffer any losses), so she wants to be fairly confident before proceeding with this venture.
Required: Use the CVP Equation Method (& template) to Analyze:
In: Accounting
photoelectric physics lab
Even though this experiment is mathematically simple, its
conceptual significance is immense. Explain how the experiment
confirms the quantized nature of photon energy. How is the
connection established between wave and particle theories of light?
How are we able to see that electrons in atoms exist in discrete
energy orbitals?
In: Physics
1 for each of the problems listed below write the c++ program while using WHILE loop structures
A program will display each term in the following sequence
1 -10 100 -1000 10000 -100000 1000000
A program will calculate and display the corresponding celsius temperatures for the given Farenheit ones from 0f to 212 f (hint c=(f-32/1.8)
In: Computer Science
A parallel plate capacitor with plate separation d is connected to a battery. The capacitor is fully charged to Q Coulombs and a voltage of V. (C is the capacitance and U is the stored energy.) Answer the following questions regarding the capacitor charged by a battery.
For each statement below, select True or False.
1. With the capacitor connected to the battery, increasing d increases U.
2. After being disconnected from the battery, inserting a dielectric with κ will decrease V.
3. With the capacitor connected to the battery, decreasing d decreases Q.
4. After being disconnected from the battery, inserting a dielectric with κ will increase U.
5. After being disconnected from the battery, inserting a dielectric with κ will decrease C.
6. After being disconnected from the battery, decreasing d increases C.
In: Physics
The pkb values for the dibasic base B are pkb1 = 2.10 and pkb2 = 7.34. Calculate the pH at each of the following points in the titration of 50.0 mL of a 0.50 M B(aq) with 0.50 M HCl (aq).
a) before addition of any HCl d) after addition of 75.0 mL of HCl
b) after addition of 25.0 mL of HCl e) after addition of 100.0 mL of HCl
c) after addition of 50.0 mL of HCl
In: Chemistry
What are the identified weaknesses in your organization’s
Compensation
System? Suggest better models for the company.
In: Operations Management
Deducing a Reaction Mechanism for the Isomerization of Maleic acid to fumaric acid. I'm completing my organic chemistry lab report and answering questions and I have very confused and would appreciate any help and explanation please. I appreciate it.
Test Tube |
Solids |
Solvents |
Precipitate |
A |
1.0 g maleic acid |
3.0 mL 6 M HCl |
Yes |
B |
1.0 g maleic acid |
3.0 mL 3 M H2SO4 |
No |
C |
1.0 g maleic acid 0.5 g ammonium chloride |
3.0 mL distilled water |
No |
D |
1.0 g maleic acid 0.5 g ammonium chloride |
3.0 mL 6 M HCl |
Yes |
E |
1.0 g malic acid |
3.0 mL 6 M HCl |
No |
F |
1.0 g maleic acid |
1.5 mL distilled water 2.0 mL conc. HBr |
Yes |
Possible Mechanisms for the Isomerization.
1. Maleic acid is activiated by visible light, and then rearranges to form fumaric acid. In this mechanism, the pi-bond is momentarily broken, allowing for the free rotation to give the more stable trans isomer. The double bond then reforms.
2. The rearrangement of maleic acid to fumaric acid is accomplished by the thermal excitation of the molecule. In this mechanism, the pi-bond is broken by the application of heat. As described above, this would allow rotation to occur and form the more stable trans isomer.
3. A nudeophilic addition of a chloride ion to maleic acid again permits free rotation, followed by release of the Cl- ion to produce fumaric acid.
4. An electrophilic addition of a proton to maleic acid, followed by rotation and then deprotonation.
5. Water adds to maleic acid (under acid catalysis) to form laic acid. Malic acid then rotates to a new conformation and elimenates water to form fumaric acid.
6. The addition of a proton to maleic acid leads to the formation of a lactone (cyclic ester) which undergoes a ring opening reaction to yield malic acid. Malic acid is then dehydrated to give fumaric acid.
7. A proton adds to the carbonyl oxygen to give an intermediate with a number of resonance structures. One of these resonance structures can freely rotate and deprotonation to give fumaric acid.
8. A proton adds to the carbonyl oxygen, followed by an addtion of a chloride ion. The product of this 1,4 addition then undergoes a free rotation, and hydrochloric acid is eliminated to produce fumaric acid.
So, I understand that I can go through a process and eliminate the first 7 reaction mechanisms to chose the last one #8 is close to the true state of affairs.
But I am struggling answering these questions, if anyone can help and provide an explanation I'd greatly appreciate it.
Questions #1: 1. Is visible light solely responsible for the isomerization of maleic acid to fumaric acid? Explain.
2. If the isomerization of maleic acid to fumaric acid is a thermal effect, which test tubes should contain fumaric acid?
3. For mechanism 3 to be correct, which test tubes should contain fumaric acid?
4. For mechanism 4 to be correct, which test tubes should contain fumaric acid?
5. For mechanism 5 to be correct, which test tubes must contain fumaric acid?
6. Which test might rule out mechanism 6 as a possibility?
7. For mechanism 7 to be correct, which test tubes must contain fumaric acid?
8. For mechanism 8 to be correct, which test tubes must contain fumaric acid?
Then these questions:
1. Does sulfuric acid, which ionizes to give a negatively charged sulfate ion, induce the isomerization of maleic acid to fumaric acid? Explain.
Anybody answer this?
In: Chemistry
A 8.0 V potential difference is applied between the ends of a 0.80 mm -diameter, 25 cm -long nichrome wire. What is the current in the wire?
In: Physics
In 250 words Consider some of the terms used to refer to the decades between World War 1 and World War 2 1918-1945. The Roaring Twenties, The Jazz Age, The Golden Age, The Age of Intolerance, etc. what you know about this historical time period and what these terms reference (significant events, cultural behaviors, political issues)? How is this period in history stereotyped or remembered? please type
In: Psychology