What does this mean in C++ syntax?
(leftover < 0 ? -leftover : 0)
and
(leftover > 0 ? leftover : 0)
Full version:
// rugfit1.cpp - calculates fit of rug to a floor
#include <iostream>
using namespace std;
// utility function to calculate area of a rectangle
double area(double width, double length) {
return width * length;
}
int main() {
double floorWidth, floorLength, rugWidth, rugLength,
floorArea, rugArea, leftover;
cout << "enter width and length of floor: ";
cin >> floorWidth >> floorLength;
cout << "enter width and length of rug: ";
cin >> rugWidth >> rugLength;
floorArea = area(floorWidth, floorLength);
rugArea = area(rugWidth, rugLength);
leftover = rugArea - floorArea;
cout << "floor area: " << floorArea <<
endl;
cout << "rug area: " << rugArea << endl;
cout << "leftover rug area: " <<
(leftover > 0 ? leftover : 0) << endl;
cout << "empty floor area: " <<
(leftover < 0 ? -leftover : 0) << endl;
return 0;
}
In: Computer Science
Identify and briefly explain what is meant by each of the
following terms:
a. horizontal scope
b. vertical scope
c. scope of the firm
In: Operations Management
We have seen the shift from a naturalistic representation of the human form (with an emphasis on idealization in Greek art and realism in Roman) to a more conceptual, formulaic representation. Why do you think this happened? What is the advantage to conveying a message through images that no longer focus on a representation of the natural world? Use two examples in your response
In: Psychology
Task 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
For this task, you will need to search for related literature to _nd your answer. You
must make use of the LNCS referencing style required here:
https://www:springer:com/gp/computer-science/lncs/conference-proceedings-
guidelines.
Look at the guidelines and the templates for reference examples. Failure to provide citations in LNCS style will result in mark forfeiture. You are also limited to use scientific material and books; websites like Wikipedia and StackOverflow are not considered a credible source.
5.1 What are the next developments that are proposed by researchers in the area (1)
of RAID (not covered in the textbook)? Choose a particular development and
very briefly discuss it. Provide the necessary references for your answer.
In: Computer Science
11. Managers who train and supervise the performance of nonmanagerial employees and who are directly responsible for producing the company's products or services are categorized as:
a. middle managers
b. team leaders
c. general managers
d. top managers
e. first-line managers
12. Mike Walker supervises operations on the chassis assembly line for a large vehicle manufacturer. Most of his time is spent in quality control maintenance, scheduling workers, and training new employees. Walker would be categorized as a:
a. team leader
b. top manager
c. first-line manager
d. group facilitator
e. middle manager
13. The two kinds of external organizational environments are the general environment and the specific environment.
True
False
14. External environments are the forces and events outside a company that have the potential to influence or affect it.
True
False
15. Resource scarcity is the degree to which an organization's external environment has an abundance or lack of critical organizational resources.
True
False
16. The best way to manage legal responsibilities is to retain a large staff of legal specialists to defend the company against any charges.
True
False
17. Organizational culture refers to the set of key values, beliefs, and attitudes shared by organizational members.
True
False
18. ____ is a tactic in which an advocacy group actively tries to convince consumers not to purchase a company's product or service.
a. Product boycott
b. Media advocacy
c. Lobbying
d. Market denigration
e. Public communications
In: Operations Management
In: Finance
Mest Company has nine employees. FICA Social Security taxes are 6.2% of the first $127,200 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes are 5.4% of the first $7,000 paid to each employee. Cumulative pay for the current year for each of its employees follows.
Employee | Cumulative Pay | Employee | Cumulative Pay | Employee | Cumulative Pay | |||
Ken S | $ | 6,300 | Michelle W | $ | 153,000 | Lori K | $ | 139,200 |
Tim V | 52,300 | Michael M | 116,400 | Kitty O | 46,400 | |||
Steve S | 96,500 | Zach R | 136,700 | John W | 13,500 | |||
a. Compute the amounts in this table for each
employee.
Pay Subject to | Pay Subject | Pay Subject | Pay Subject | ||
Cumulative | FICA Social | to FICA | to FUTA | to SUTA | |
Employee | Pay | Security | Medicare | Taxes | Taxes |
Ken S | $6,300 | ||||
Tim V | 52,300 | ||||
Steve S | 96,500 | ||||
Michelle W | 153,000 | ||||
Michael M | 116,400 | ||||
Zach R | 136,700 | ||||
Lori K | 139,200 | ||||
Kitty O | 46,400 | ||||
John W | 13,500 | ||||
Totals | $760,300 | $9,617 | $0 | $0 | $0 |
b. For the company, compute each total for: FICA Social Security taxes, FICA Medicare taxes, FUTA taxes, and SUTA taxes.
|
In: Finance
Chapter 18 Discussion and Lecture Comments
23 23 unread replies. 23 23 replies.
The Rebuilding Decision
After Tom and Elise Ryan finished veterinary school in the early 2000s, they spent several years working for other veterinary clinics. By 2007, they felt it was time for them to start their own practice. They considered several towns in the south-central United States, visiting local chambers of commerce and studying each town’s demographics. They finally settled in Wardston, a small city in Arkansas. Wardston is a regional center for the surrounding counties, located at the intersection of a two major cross-state highways. The industry rule of thumb is that it takes a population of 1,500 pet owners to support one veterinarian. Wardston appeared to be an underserved area, and no other veterinarian in the area was treating large animals. A big factor in their decision also was the fact that Elise’s parents and three brothers lived in Wardston. “If we failed, at least we knew we could get a good homemade meal,” said Tom.
They bought an abandoned veterinary clinic with a three-quarter-acre plot of land on the major thoroughfare. The clinic, a sturdy 2,000-square-foot cinderblock structure, had been constructed in 1950 and needed major renovations. Tom and Elise were still paying off $45,000 in student loans and had no savings to draw on. However, Elise’s parents agreed to deed them a house and tract of land to get started. Now a property owner, Tom was able to borrow $165,000 from a local bank. Tom’s family took out a home equity loan to help them complete the renovations. When the clinic opened in the summer of 2008, the small concrete building had been transformed into the Wardston Animal Hospital, a 4,000-square-foot veterinary clinic, complete with treatment room, surgery, kennels, and offices.
As they had anticipated, the area badly needed another vet clinic, and business began to boom. They were able to pay off the loan from Tom’s parents and make improvements to the clinic’s parking area. By 2010, the Wardston Animal Hospital had grown large enough to need another vet, and Dr. Laura Hyde joined the practice. She soon became an equal partner with Tom and Elise.
The clinic building, while adequate for a small practice, was still half a century old with an inconvenient traffic flow. The building was designed around a single center hallway going from north to south. Clients going to exam rooms, animals being weighed, vets heading to treatment rooms, staff going to the break room all had to go down same central hallway. The partners always knew that they eventually wanted to build a new “ideal” clinic. Elise kept a notebook full of ideas and possible floor plans that they dubbed their “five-year plan.”
Then in April 2015 a line of severe thunderstorms passed through the city. It was a Wednesday afternoon, the clinic’s early closure day, and the staff—with the exception of the office manager—had left the building. At 3:00 p.m., a tornado dropped out of the squall line and plowed through the northern part of the city, tearing the roof off the Wardston clinic and wrapping it around several nearby pine trees. For three hours, a steady downpour flooded the damaged building, leaving six inches of water on the treatment room floor. Worse still, the rainwater soaked into the insulation in the walls, the sheetrock on the walls, and the ceiling tiles. Volunteers, staff, even other veterinarians flocked to the clinic to help ferry the boarded animals to temporary homes and clean up the shredded interior. None of the animals were hurt, and no one was injured, although the clinic office manager was in shock for a few days.
Within two weeks, the partners were back in business, operating out of a doublewide trailer set up on the north side of the parking lot. They hired a cleanup service to start the long process of recovery. The cleaning crew soon realized the extent of the damage and told the partners that the cleanup would be very costly. They also warned that the soggy walls and ceiling would probably have mildew problems in the future no matter how thoroughly the building was cleaned.
Tom, Elise, and Laura had to make a decision about how to proceed. As Tom saw it, there were four options to consider:
Plan A: Restore the building to its existing condition before the tornado. The $150,000 insurance settlement would just cover the renovation costs. This option would be the least costly, but they would still have the same 55-year-old building with the same bad traffic flow.
Plan B: Gut the old building and create the “ideal” building within the old shell, total cost approximately $400,000.
Plan C: Level the old building and rebuild on the site. This option was almost immediately eliminated for several reasons. First, the cost just to demolish the building would be $50,000. Also, the clinic staff was using undamaged parts of the old building for kennel space and storage. The doublewide trailer alone would be inadequate to support the practice if the old building were immediately demolished.
Plan D: Build the clinic of their dreams on land the partners owned adjacent to the clinic. The clinic would take almost a year to complete at a cost of $650,000.
Discussion questions for bonus case 18-1
In: Finance
USE JAVA PLEASE
Use recursion to implement a method
public static int indexOf(String text, String str)
that returns the starting position of the first substring of the
text that matches str.
Return –1 if str is not a substring of the text.
For example, s.indexOf("Mississippi", "sip") returns 6.
Hint: You must keep track of how far the match is from the beginning of the text. Make that value a parameter variable of a helper method.
In: Computer Science
What rate do you need to earn annually for an initial investment of a $1 to equal $10 if you are investing for only a five-year period? SHOW WORK, Explain thoroughly AND USE EXCEL Please and many Thanks. I want to learn this, but I am stuck on this one.
In: Finance
Problem Description:
Write a program that prompts the user to enter a directory and displays the number of the files in the directory.
Analysis:
(Describe the problem including input and output in your own words.)
Design:
(Describe the major steps for solving the problem. How do you use recursion to solve this problem.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
Name the public class Exercise18_29
Testing: (Describe how you test this program)
In: Computer Science
I have questions in regards to the following code
1. package Week_5;
2. import java.util.InputMismatchException;
3. import java.util.Scanner;
4. public class Customer {
5. public String firstName;
6. public String lastName;
7. public String FullName()
8. {
9. return this.firstName+" "+this.lastName;
10. }
11. }
12. public class ItemsForSale {
13. public String itemName;
14. public double itemCost;
15. public boolean taxable;
16. public void PopulateItem(String iName, double iCost, boolean canTax)
17. {
18. this.itemName = iName;
19. this.itemCost = iCost;
20. this.taxable = canTax;
21. }
22. }
23. class PRG215_Week_5 {
24. public static void main(String[] args) {
25. final int TOTAL_ITEMS = 6;
26. ItemsForSale[] items = new ItemsForSale[TOTAL_ITEMS];
27. for(int i = 0; i < TOTAL_ITEMS; i++)
28. {
29. items[i] = new ItemsForSale();
30. }
31. items[0].PopulateItem("Tennis Shoes",45.89,true);
32. items[1].PopulateItem("Shits", 25.55, true);
33. items[2].PopulateItem("Coats", 89.99, true);
34. items[3].PopulateItem("Belts", 15, true);
35. items[4].PopulateItem("Pants", 25.99, true);
36. items[5].PopulateItem("Donation", 10, false);
37. double totalAmount = 0.0;
38. double totalTax = 0.0;
39. double taxRate = 0.081;
40. final double DISCOUNT_RATE = 0.025;
41. final double AMOUNT_TO_QUALIFY_FOR_DISCOUNT = 100;
42. double discountAmount = 0;
43. System.out.println("The following clothing items are available for purchase:");
44. for(int i=0; i < items.length; i++)
45. {
46. //Display each item in the array
47. System.out.println(" "+(i + 1)+". "+items[i].itemName+ " for $"+items[i].itemCost+" each");
48. }
49. System.out.println("");
50. Scanner keyboard = new Scanner(System.in);
51. Customer newCust = new Customer();
52. System.out.print("Please enter your first name: ");
53. newCust.firstName = keyboard.next();
54. System.out.print("Please enter your last name: ");
55. newCust.lastName = keyboard.next();
56. System.out.println("");
57. System.out.println("Ok, " + newCust.FullName()+", please enter the product ID (the number to the left of the item name) that you wish to purchase. Enter 0 when you are finished.");
58. int itemID = 0;
59. int itemCounter = 1;
60. do 61. {
62. System.out.print("Please enter item ID number "+(itemCounter)+": ");
63. try
64. {
65. itemID = keyboard.nextInt();
66. if(itemID > 0)
67. {
68. totalAmount = totalAmount + items[itemID - 1].itemCost;
69. if(items[itemID - 1].taxable == true)
70. {
71. totalTax = totalTax + (items[itemID - 1].itemCost * taxRate);
72. }
73. itemCounter++;
74. }
75. }
76. catch (ArrayIndexOutOfBoundsException e1)
77. {
78. System.out.println("The item ID you entered is outside the range of possible items. This must be a number between 1 and "+ TOTAL_ITEMS+". Please re-enter your item ID. ");
79. itemID = -1;
80. }
81. catch (InputMismatchException e2)
82. {
83. //Display the error message
84. System.out.println("The item ID you entered does not appear to be an ingeger number. The item ID must be a number between 1 and "+ TOTAL_ITEMS+". Please re-enter your item ID. ");
85. keyboard.nextLine(); 86. itemID = -1;
87. }
88.
89. } while (itemID != 0); //Check if exit condition has been met
90. if(totalAmount >= AMOUNT_TO_QUALIFY_FOR_DISCOUNT)
91. {
92. discountAmount = totalAmount * DISCOUNT_RATE;
93. }
94. else
95. {
96. discountAmount = 0;
97. }
98. System.out.println("");
99. System.out.println("You selected "+itemCounter+" items to purchase.");
100. System.out.println("Your sales total $"+totalAmount);
101. System.out.println("Your discount amount is $"+discountAmount);
102. System.out.println("Your sales tax is $"+totalTax);
103. System.out.println("The total amount due is $"+(totalAmount - discountAmount + totalTax));
104. System.out.println("");
105. }
106. }
Questions
1. List one variable declaration and one constant declared in the code, along with the line number where you found the declaration. Why did the programmer declare it as a variable or constant?
2. What data types are referenced in the code on pages? For each data type, provide the line number of a declaration using that data type as well as the declaration itself. Additionally, list the primitive data types available in Java that are not referenced in the code.
3. Identify the different operators in the code, along with the line number where you found the operator example. Also identify the type of each operator listed as arithmetic, logical, relational, empty, or conditional.
4. Identify the control flow statements in the code. For each control flow statement, give the line number where you found the statement example. Also, list whether that statement is a decision-making, looping, or branching statement.
5. Identify the class definitions, object instantiations, and method calls in the code. Give the line number where you found each.
Below is a hypothetical example
Example: Class definitions
• Patient, line 22
• InsuranceCompany, line 49
• Physician, line 77 Object instantiations
• Alfred Smith, line 89
• Southwest HMO, line 95
• Dr. Smiley Jones, line 98 Method calls
• scheduleFollowUp(“Anne White”, “02/08/19”, “12:45”), line 124
• remitBill(“George Torres”, 33535), line 155
• referPatient(“Bob Allen”), line 189
In: Computer Science
Assume a linear model and then add 0-mean Gaussian noise to generate a sample. Divide your sample into two as training and validation sets.
Use linear regression using the training half. Compute error on the validation set. Do the same for polynomials of degrees 2 and 3 as well
In: Computer Science
C Programming question part 3: The following program is an emergency hospital patient admitting process. This program needs a few changes to be sufficient for the hospital. The social security number needs to be encrypted. The hospital would like to do this by having you create a function will accept as input a properly formatted social security number. Then increment each digit by one. If the digit is "9" then make it a "0". Return a properly formatted social security number.
Then create a function that will do the opposite. This function will take an encoded social security number and convert it back into an unencrypted social security number. The de-encoded number is what this function will return.
For each patient, print their full name, their original social security number, their encoded social security number, and then their de-encoded social security number.
a.For each patient, print their full name, their original social security number, their encoded social security number, and then their de-encoded social security number.
#include
#include
#include
#include
using namespace std;
int main() {
char lname[][10]=
{"Johnson","Williams","Ling","Albin","Anderson","Baca","Birner","Dominguez","Aimino","Armstrong","Beard","Calderon","Carter","Chaname","
Chaney"}; char fname[][10] =
{"Fred","Betty","Hector","Ross","Jason","Elisa","Dalton","Javier","Ann","Addison","Cindy","Yamil","Thomas","Bryan","Kris"};
char middle[] =
{'N','L','X','L','O','L','M','B','S','T','J','C','P','D','Z'}; char
addr[][50] = {"2763 Filibuster Drive","701 Collage Avenue","1500
Raceway Lane","207 Daisy Avenue","1527 Lewis Road","25 Hunters
Lane","851 Applebe Court","1410 Waterford Blvd","2379 Runners
Way","46 Hawthorne Drive","1814 Constitution Ct","345 Cigar
Row","896 Pine Avenue","24 Blue Belt Drive","2589 College Court"};
cities[]={"Lakeland","Orlando","Tampa","Lakeland","Tampa","Lakeland","Orlando","Orlando","Lakeland","Lakeland","Orlando","Tampa","Tampa"
,"Lakeland","Orlando"};int zip[] =
{37643,31234,32785,32643,32785,32643,31234,31234,32643,32643,31234,32785,32785,32643,31234};
char gender[] =
{'M','F','M','M','M','F','M','M','F','M','F','M','M','M','F'}; char
dob[][11] =
{"05/27/1935","11/27/1971","10/17/2003","12/08/1990","11/25/1991","10/30/1992","09/22/1993","08/04/1994","07/11/1995","06/18/1996","05/2
8/1997","04/07/1998","03/12/1999","02/23/2000","01/15/2001"}; char
social[][12] =
{"164-55-0726","948-44-1038","193-74-0274","458-57-2867","093-00-1093","159-56-9731","695-21-2340","753-66-
6482","852-73-4196","648-81-1456","879-61-1829","123-87-0000","000-65-3197","741-85-9632","963-25-7418"};
vector fullName;
vector zombies_zip;
std::map dups;
char buffer[16];
char buffer2[16];
// for (int i = 0; i < 15; ++i)
// {
// //char buffer[16]; // large enough
// //char buffer2[16];
// strcpy(buffer, lName[i]);
// strcat(buffer, fName[i]);
// cout << lName[i] << " " << fName[i] << "
" << buffer << endl;
// cout << buffer << middleInitial[i] <<
endl;
//
// }
for(int i =0; i < 15; i++){
if(zombie[i] == 'Y'){
zombies_zip.push_back(zip[i]);
}
}
sort(zombies_zip.begin(), zombies_zip.end());
// for (int i=0; i // cout << zombies_zip[i] << "\n";
for(int i : zombies_zip)
++dups[i];
for(auto& dup : dups)
cout << dup.first << " has " << dup.second
<< " zombies\n";
//cout<<"Last Name: "<< last_name << ", "<<
"First Name: " << first_name << " ," << "Middle
name: " << middle_name << " ," << "Street
address: "<< street_address << " ," << "City: "
<< city << " ," << "State: " << state
<<" ," << "Zip: " << zip << endl;
//printf("Zombie: %c, ""Gender: %c, Date of Birth: %d-%d-%d, Insurance: %c, Social Security Number %s", gender, date_of_birth[0], date_of_birth[1], date_of_birth[2], insurance, social_security_number);
//cout<<"Zombie?: "<< zombie << ", "<< "Gender: " << gender << " ," << "Date of Birth: " << date_of_birth[0] << "/" << "/" << date_of_birth[1] << date_of_birth[2] << " ," << "Insurance?: "<< insurance << " ," << "Social Security: " << social_security_number<< endl;
cout << "Number of patients: " <<
sizeof(lName)/sizeof(lName[0]) << endl;
cout<<"Number of zombies: " << num_of_zombies <<
endl;
}
New format for patient record: Last Name, First Name, Middle Initial, Address, City, State, Zip, Sex, Date of Birth, SS #, Zombie?
In: Computer Science
You deposit $11,000 annually into a life insurance fund for the
next 11 years, after which time you plan to retire.
a. If the deposits are made at the beginning of
the year and earn an interest rate of 6 percent, what will be the
amount in the retirement fund at the end of year 11?
b. Instead of a lump sum, you wish to receive
annuities for the next 22 years (years 12 through 33). What is the
constant annual payment you expect to receive at the beginning of
each year if you assume an interest rate of 6 percent during the
distribution period?
c. Repeat parts (a) and (b) above assuming earning
rates of 5 percent and 7 percent during the deposit period and
earning rates of 5 percent and 7 percent during the distribution
period.
In: Finance