#include
#include
#include
#define WORDLENGTH 30
#define MAX 100
struct car
{
char model[WORDLENGTH];
int year;
int milage;
};
typedef struct car Car;
Car createCar(char model[], int year, int milage)
{
Car c;
strcpy(c.model, model);
c.year = year;
c.milage = milage;
return c;
}
void regCars(Car reg[], int *pNrOfCars)
{
char again[WORDLENGTH] = "yes", model[WORDLENGTH];
int year, milage;
while (strcmp(again, "yes") == 0)
{
printf("Ange model:");
scanf("%s%*c", model);
printf("Ange year:");
scanf("%d%*c", &year);
printf("Ange milage:");
scanf("%d%*c", &milage);
reg[*pNrOfCars] = createCar(model, year, milage);
(*pNrOfCars)++;
printf("Do you rigister another car? enter yes or no:\n");
scanf("%s%*c", again);
}
}
void printRegister(Car reg[], int nrOfCars)
{
int i = 0;
for (i = 0; i < nrOfCars; i++)
{
printf("%d. Car: %s, Year model: %d, Mil: %d\n", i + 1, reg[i].model, reg[i].year, reg[i].milage);
}
}
int main()
{
Car carRegister[MAX];
int nrOfCars = 0;
char r[100];
printf("register a car\n");
regCars(carRegister, &nrOfCars);
printf("Do you want to print the cars details or quit? entr print or quit:\n");
scanf("%s", r);
if (strcmp(r, "print") == 0)
printRegister(carRegister, nrOfCars);
else
exit(1);
return 0;
}
Add a menu item that is "Increase miles" where you should be able to select a car by entering its location in the register and then can increase the number of miles it has traveled. So to increase the fiat's miles above, enter 3.
Edit: this question is a following question to a previous one which was:
In question number one we should Add the function that prints
all cars in the register in our car register program. The printout
should look as follows:
1. Car: Volvo, Year model: 2011, Mil: 3000
2. Car: Saab, Year model: 2000, Mil: 5000
Car: Fiat, Model year: 1999, Mil: 40000
Then in a separate question we should Change the program so that it
starts with a menu according to
below. Depending on what you choose, the correct function is
called. Then the user gets another chance to choose until he
chooses to quit.
• register cars
• Print all cars
• Exit
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define WORDLENGTH 30
#define MAX 100
struct car{
char model[WORDLENGTH];
int year;
int milage;
};
typedef struct car Car;
void printCar(Car c){
printf("Bil: %s, Arsmodell: %d, mil:
%d\n",c.model,c.year,c.milage);
}
Car createCar(char model[],int year, int milage){
Car c;
strcpy(c.model,model);
c.year=year;
c.milage=milage;
return c;
}
void regCars(Car reg[],int *pNrOfCars){
char again[WORDLENGTH] = "ja", model[WORDLENGTH];
int year,milage;
while(strcmp(again,"ja")==0){
printf("Ange model:");
scanf("%s%*c",model);
printf("Ange year:");
scanf("%d%*c",&year);
printf("Ange milage:");
scanf("%d%*c",&milage);
reg[*pNrOfCars]=createCar(model,year,milage);
(*pNrOfCars)++;
printf("Vill du fortsatta? (ja/nej)");
scanf("%s%*c",again); }
}
void printRegister(Car reg[], int nrOfCars){}
int main(){
Car carRegister[MAX];
int nrOfCars=0;
regCars(carRegister,&nrOfCars);
printRegister(carRegister, nrOfCars);
return 0;
}
the answer was:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define WORDLENGTH 30
#define MAX 100
struct car{
char model[WORDLENGTH];
int year;
int milage;
};
typedef struct car Car;
Car createCar(char model[],int year, int milage){
Car c;
strcpy(c.model,model);
c.year=year;
c.milage=milage;
return c;
}
void regCars(Car reg[],int *pNrOfCars){
char again[WORDLENGTH] = "yes", model[WORDLENGTH];
int year,milage;
while(strcmp(again,"yes")==0){
printf("Ange model:");
scanf("%s%*c",model);
printf("Ange year:");
scanf("%d%*c",&year);
printf("Ange milage:");
scanf("%d%*c",&milage);
reg[*pNrOfCars]=createCar(model,year,milage);
(*pNrOfCars)++;
printf("Do you rigister another car? enter yes or no:\n");
scanf("%s%*c",again); }
}
void printRegister(Car reg[], int nrOfCars){
int i=0;
for(i=0;i<nrOfCars;i++)
{
printf("%d. Car: %s, Year model: %d, Mil: %d\n",i+1,reg[i].model,reg[i].year,reg[i].milage);
}
}
int main(){
Car carRegister[MAX];
int nrOfCars=0;
char r[100];
printf("register a car\n");
regCars(carRegister,&nrOfCars);
printf("Do you want to print the cars details or quit? entr print or quit:\n");
scanf("%s",r);
if(strcmp(r,"print")==0)
printRegister(carRegister, nrOfCars);
else
exit(1);
return 0;
}In: Computer Science
Buckeye Creek Amusement Park is open from the beginning of May to the end of October. Buckeye Creek relies heavily on the sale of season passes. The sale of season passes brings in significant revenue prior to the park opening each season, and season pass holders contribute a substantial portion of the food, beverage, and novelty sales in the park. Greg Ross, director of marketing at Buckeye Creek, has been asked to develop a targeted marketing campaign to increase season pass sales. Greg has data for last season that show the number of season pass holders for each zip code within 50 miles of Buckeye Creek. he has also obtained the total population of each zip code from the U.S. Census bureau website. Greg thinks it may be possible to use regression analysis to predict the number of season pass holders in a zip code given the total population of a zip code. If this is possible, he could then conduct a direct mail campaign that would target zip codes that have fewer than the expected number of season pass holders.
1. Did the estimated regression equation provide a good fit?
2. Use residual analysis to determine whether the assumed regression model is appropriate.
3. Discuss if/how the estimated regression equation should be used to guide the marketing campaign.
4. What other data might be useful to predict the number of season pass holders in a zip code?
|
ZIP Code |
Population | Season Pass Holders |
| 45220 | 14171 | 224 |
| 45219 | 17576 | 42 |
| 45225 | 13437 | 15 |
| 45217 | 5731 | 78 |
| 45214 | 9952 | 19 |
| 45232 | 6913 | 28 |
| 45223 | 13349 | 83 |
| 45229 | 15713 | 75 |
| 45206 | 11353 | 69 |
| 45202 | 15105 | 83 |
| 45203 | 3411 | 9 |
| 45207 | 8233 | 8 |
| 41074 | 5566 | 36 |
| 41073 | 6193 | 63 |
| 45224 | 21043 | 207 |
| 41071 | 21596 | 133 |
| 45205 | 21683 | 102 |
| 45204 | 6642 | 36 |
| 41016 | 5603 | 42 |
| 45216 | 9028 | 55 |
| 45212 | 22356 | 207 |
| 41011 | 25849 | 193 |
| 41014 | 7913 | 41 |
| 45237 | 21137 | 86 |
| 45208 | 18236 | 424 |
| 45211 | 33968 | 342 |
| 45239 | 26485 | 269 |
| 41075 | 15868 | 236 |
| 45209 | 8941 | 111 |
| 45226 | 5029 | 84 |
| 45238 | 42737 | 564 |
| 45231 | 39939 | 361 |
| 45213 | 11683 | 153 |
| 45215 | 28915 | 308 |
| 45218 | 3917 | 54 |
| 41017 | 40218 | 493 |
| 41076 | 14779 | 176 |
| 45251 | 22887 | 205 |
| 45227 | 18431 | 215 |
| 45247 | 20372 | 357 |
| 41015 | 22298 | 189 |
| 45248 | 22880 | 380 |
| 45236 | 21823 | 310 |
| 45240 | 27033 | 142 |
| 45246 | 13522 | 100 |
| 45230 | 25763 | 423 |
| 45233 | 14175 | 244 |
| 45252 | 4799 | 58 |
| 41018 | 29001 | 244 |
| 45243 | 14755 | 303 |
| 45241 | 25623 | 299 |
| 45014 | 44178 | 307 |
| 45242 | 20015 | 377 |
| 45244 | 26316 | 448 |
| 41059 | 2266 | 22 |
| 41048 | 12597 | 214 |
| 41051 | 18730 | 323 |
| 45255 | 22552 | 307 |
| 45174 | 2072 | 52 |
| 41042 | 50429 | 440 |
| 45002 | 13298 | 184 |
| 45015 | 12504 | 47 |
| 45069 | 46264 | 561 |
| 45052 | 3770 | 52 |
| 45249 | 13432 | 154 |
| 41001 | 16982 | 164 |
| 41005 | 20892 | 209 |
| 45011 | 62303 | 496 |
| 45245 | 17701 | 189 |
| 41091 | 17372 | 226 |
| 45013 | 51730 | 286 |
| 45150 | 31179 | 316 |
| 41094 | 9748 | 106 |
| 45030 | 16386 | 192 |
| 45140 | 52874 | 657 |
| 41063 | 3662 | 19 |
| 45040 | 51183 | 549 |
| 45102 | 22009 | 217 |
| 45039 | 21398 | 278 |
| 41007 | 3215 | 26 |
| 45053 | 3441 | 25 |
| 45157 | 10312 | 72 |
| 45050 | 6988 | 80 |
| 41080 | 2114 | 11 |
| 45067 | 12507 | 62 |
| 45034 | 1227 | 11 |
| 45103 | 29874 | 267 |
| 47025 | 21986 | 154 |
| 45044 | 49621 | 322 |
| 41030 | 7280 | 35 |
| 41092 | 3198 | 18 |
| 45065 | 5194 | 35 |
| 41033 | 1712 | 11 |
| 47060 | 6910 | 38 |
| 41006 | 4835 | 19 |
| 45122 | 12550 | 59 |
| 45042 | 28821 | 91 |
| 45056 | 28811 | 88 |
| 45036 | 36066 | 225 |
| 45064 | 2376 | 9 |
| 47040 | 5242 | 10 |
| 45153 | 2132 | 10 |
| 45152 | 9686 | 101 |
| 47022 | 2740 | 17 |
| 47001 | 10370 | 36 |
| 45162 | 2900 | 11 |
| 45005 | 31944 | 93 |
| 41035 | 9671 | 54 |
| 45106 | 12675 | 61 |
| 45176 | 8485 | 47 |
| 45311 | 7381 | 10 |
| 41043 | 2968 | 7 |
| 45327 | 7961 | 13 |
| 41040 | 7249 | 14 |
| 45066 | 23119 | 129 |
| 41097 | 6854 | 22 |
| 45054 | 1730 | 12 |
| 41095 | 4218 | 11 |
| 45120 | 3774 | 20 |
| 45342 | 31929 | 55 |
| 47032 | 3628 | 10 |
| 45107 | 9608 | 40 |
| 47012 | 10579 | 23 |
| 45130 | 4202 | 17 |
| 45118 | 4239 | 23 |
| 41086 | 1602 | 5 |
| 47018 | 4435 | 12 |
| 45458 | 26281 | 75 |
| 45449 | 19237 | 15 |
| 45068 | 11293 | 28 |
| 47041 | 5544 | 18 |
| 45113 | 4118 | 16 |
| 45154 | 8093 | 41 |
| 45320 | 15282 | 8 |
| 45459 | 26744 | 39 |
| 47031 | 5179 | 12 |
| 41004 | 4311 | 9 |
| 41003 | 2397 | 5 |
| 41010 | 3321 | 5 |
| 41002 | 2104 | 6 |
| 45429 | 25537 | 39 |
| 45305 | 11159 | 16 |
| 45409 | 13554 | 9 |
| 45419 | 15782 | 33 |
| 45121 | 8919 | 26 |
| 45440 | 19463 | 25 |
| 45420 | 24393 | 20 |
| 45410 | 17025 | 7 |
| 45430 | 7137 | 7 |
| 45403 | 16794 | 8 |
| 45142 | 4973 | 10 |
In: Statistics and Probability
| The length, width, and height of a box are measured as 5 ft, 4 ft, and 8 ft, respectively, with an error in measurement of at most 0.3 ft in each. Use differentials to estimate the maximum error (in feet) in the calculated volume of the box. |
In: Math
Calculate the minimum prestressing force required for Beam 1 knowing that the beam has a cross sectional area of 200 × 500 mm and an allowable stress of 0.3 N/mm2 . External Load applied in Tons/m is 150
In: Civil Engineering
1.Steam is accelerated by a nozzle steadily from a low velocity to a velocity of 210 m/s at a rate of 3.2 kg/s. If the temperature and pressure of the steam at the nozzle exit are 400 °C and 2 MPa, the exit area of the nozzle is:
Select one:
a. 8.4 cm2
b. 10.2 cm2
c. 23.0 cm2
d. 152 cm2
e. 24.0 cm2
2.An adiabatic heat exchanger is used to heat cold water at 15 °C entering at a rate of 5 kg/s by hot water at 90 °Centering at a rate of 4 kg/s. If the exit temperature of hot water is 50 °C, the exit temperature of cold water is
Select one:
a. 47 °C
b. 55 °C
c. 78 °C
d. 42 °C
e. 90 °C
3.Steam is compressed by an adiabatic compressor from 0.2 MPa and 150 °C to 0.8 MPa and 350 °C at a rate of 1.30 kg/s. The power input to the compressor is:
Select one:
a. 302 kW
b. 717 kW
c. 901 kW
d. 511 kW
e. 393 kW
4.Hot combustion gases (assumed to have the properties of air at room temperature) enter a gas turbine at 1 MPa and 1500 K at a rate of 0.1 kg/s, and exit at 0.2 MPa and 900 K. If heat is lost from the turbine to the surroundings at a rate of 15 kJ/s, the power output of the gas turbine is:
Select one:
a. 45 kW
b. 15 kW
c. 60 kW
d. 75 kW
e. 30 kW
5.Refrigerant -134a expands in an adiabatic turbine from 1.2 MPa and 100 °C to 0.18 MPa and 50 °C at a rate of 1.25 kg/s. The power output of the turbine is:
Select one:
a. 46.3 kW
b. 72.7 kW
c. 66.4 kW
d. 89.2 kW
e. 112.0 kW
6.Refrigerant -134a at 1.4 MPa abd 90°C is throttled to a pressure of 0.6 MPa. The temperature of the refrigerant after throttling is:
Select one:
a. 82 °C
b. 80 °C
c. 22 °C
d. 90 °C
e. 56 °C
7.Air is to be heated steadily by an 8 kW electric resistance heater as it flows through an insulated duct. If the air enters at 50°C at a rate of 2 kg/s, the exit temperature of air is:
Select one:
a. 46.0 °C
b. 54.0 °C
c. 50.0 °C
d. 55.4 °C
e. 58.0 °C
In: Mechanical Engineering
A) write the correct charge balance equation for a solution containing 0.2 M AlPO4 and 0.1 M BaCl2
B) write the correct mass balance relationship for CH3CO2Na
In: Chemistry
P(A1) = 0.2, P(A2) = 0.25
A1 and A2 are independent
Find P(A1C ∩ A2)
Please add a venn diagram if possible
Thanks in advance!
In: Statistics and Probability
What is the pH when 125 mL of 0.1 M NaOH is added to 175 mL of 0.2 M CH3COOH (acetic acid) if pKa for acetic acid = 4.76?
In: Chemistry
What is the pH when 125 mL of 0.1 M NaOH is added to 175 mL of 0.2 M CH3COOH (acetic acid) if pKa for acetic acid = 4.76?
In: Chemistry
The joint pmf of ? and ? is given by ??,? (?, ?) = (? + ?)/ 27 ??? ? = 0, 1,2; ? = 1, 2, 3, and ??,? (?, ?) = 0 otherwise. a. Find ?(?|? = ?) for all ? = 0,1, 2. b. Find ?(3 + 0.2?|? = 2).
In: Statistics and Probability