please code in c language and follow all instructions and sample run.
Simone works for a group that wants to register more people to
vote. She knows her team can only ask a
certain number of people at any given time since they have other
obligations. She has asked you to create a
program for her team that allows the user to type in how many
people they want to ask at one time (the
duration of the current program run). The program will then ask
that many people (see sample run). If a
person answers y, his or her name is added to a registration list
(a file) and the current registration list is
output to screen. If they answer n, Ok is output to screen and the
program continues. Once at least 10 people
have been registered, whenever the program is opened the phrase
Target Reached! Exiting… should be
output to screen.
Step 1: You will be defining the following two functions (DO NOT
MODIFY THE DECLARATIONS):
/*This function takes a file pointer, goes through the file and
prints the file contents to screen. It returns the
number of lines in the file*/
int registered(FILE *fp)
/*This function takes a file pointer and adds a new line to the
file*/
void new_register(FILE *fp)
Step 2: Use the functions you defined to make a working
program.
Sample Run:
computer$ gcc –o vote vote.c
computer$ ./vote register.txt
***Registered so far:***
How many people to ask right now?
3
-Person 1: Would you like to register to vote?
n
Ok.
-Person 2: Would you like to register to vote?
y
Enter name: Bill Gates
Adding: Bill Gates
***Registered so far:***
1. Bill Gates
-Person 3: Would you like to register to vote?
y
Enter name: Mark Zuckerberg
Adding: Mark Zuckerberg
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3 people asked! Taking a break.
computer$ ./vote register.txt
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
How many people to ask right now?
4
-Person 1: Would you like to register to vote?
n
Ok.
-Person 2: Would you like to register to vote?
n
Ok.
-Person 3: Would you like to register to vote?
y
Enter name: Jeff Bezos
Adding: Jeff Bezos
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3. Jeff Bezos
-Person 4: Would you like to register to vote?
y
Enter name: Susan Wojcicki
Adding: Susan Wojcicki
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3. Jeff Bezos
4. Susan Wojcicki
4 people asked! Taking a break.
In: Computer Science
1. Star with Newton's third law: dp/dt = ΣF where p is the momentum. In space, the sum of the external forces ΣF = 0. For a rocket in space, the mass and velocity change with time as the rocket expends its fuel. Show from Newton's third law that ΔV = v ln(m/M) where m is the initial mass of the rocket, M is the final mass of the rocket after the fuel is expended, v is the rocket's exhaust velocity and ΔV is the change in the velocity for the rocket
2. Now, the rocket needs to get to escape velocity to get to the moon. Use conservation of energy to derive an expression for the escape velocity. If we start at 200km above the surface of earth, calculate the ΔV we need to escape from Earth and get to the moon.
3. Finally, use the earlier Rocket Equation calculate the fraction of the initial rocket's mass that is dedicated to fuel to make the journey from the Earth to the Moon. In this case, v is 4500 m/s.
In: Physics
A cubical box, open at the top, with edge length 81.0 cm, is constructed from metal plate of uniform density and negligible thickness. One of the bottom corners of the box is at 0,0,0, the base of the box is in the x-y plane and the box is the positive quadrant. What is the x coordinate of the center of mass of the box (in cm.)?
What is the y coordinate of the center of mass of the box (in cm.)?
What is the z coordinate of the center of mass of the box (in cm.)?
In: Physics
The programming language has to be C
The user is going to provide you with a map of rivers and grassland. Each cell on the map will be either grassland or river. Your job is to decorate this map with forks, 4 way forks, and river bends when a river bends. You will process the user's map and modify the river cells if they depict a river bend.
You will use enums to model the river, its bends, and forks. You will pattern match to replace parts of the river with bends and forks. Out of bounds regions will be considered grasslands for pattern matching simplicity.
You will use enums in this program.
You will print the integers with 1 space padding and rows will be terminated by new lines:
10 10 10 1 2 3 4 5 6 7 8 9 10 10 10
Input and Output
The tiles that we use in the map are:
The user will input maps usually of 0 and 1 but they can include other tiles as well. Typically it will 0 and 1.
The user will input a map of
P2 6 7 10 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1 1 1 1 0 0 0 0 0 1 0
Where 0 is grassland and 1 is river
The program will look for corners and replace them with the RiverBend pieces.
P2 6 7 10 0 0 0 0 0 0 0 5 1 1 3 0 0 1 0 0 1 0 0 6 1 1 10 1 0 1 0 0 1 0 0 4 1 1 7 0 0 0 0 0 1 0
The header format is described below. $WIDTH is the number of cells wide and $HEIGHT is the number of cells tall.
P2 $WIDTH $HEIGHT 10
The individual cells are whitespace seperated for input. Ignore whitespace and newlines for the cells.
The output format is strict, each row ends in a newline and there is 1 space padding for all integers cells printed.
Please review the q1a-test?-input.txt files for more examples
Patterns
0 0 0 0 0 0 0 0 0 -> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -> 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 -> 0 0 0 1 1 1 1 1 1
These examples are in cross form, this means that the corners can be anything (river or grassland). This is only 1 cell being changed, you are expected to apply these patterns to all cells.
1 1
1 1 0 -> 1 2 0
0 0
For example:
0 1 0 0 1 0
1 1 0 -> 1 2 0
0 0 0 0 0 0
0 0
1 1 0 -> 1 3 0
1 1
For example:
1 0 1 1 0 1
1 1 0 -> 1 3 0
1 1 1 1 1 1
1 1
0 1 1 -> 0 4 1
0 0
0 0
0 1 1 -> 0 5 1
1 1
1 1
0 1 1 -> 0 6 1
1 1
1 1
1 1 0 -> 1 7 0
1 1
1 1
1 1 1 -> 1 8 1
0 0
0 0
1 1 1 -> 1 9 1
1 1
1 1
1 1 1 -> 1 10 1
1 1
More details
Maximum supported dimension in width or height is 16000
The format you input and output is called plain PGM. PGM is portable grey map format so you can use some image programs to view it.
Invalid input (including unexpected EOF) should be aborted immediately with the message:
Invalid input!
Hints
In: Computer Science
The basic pipeline for DLX has five stages IF, ID, MEM, and WB. Assuming all memory access takes 1 clock cycle
What is the control hazard of an instruction pipeline? Provide three branches of prediction alternatives to reduce branch hazard
What is the data forwarding scheme used to reduce the data hazard?
In: Computer Science
In C Language. build a singly linked list where each node stores a randomly generated value on [0,1]. Keep the list sorted. Generate some number of nodes at startup. Print out the list formatted as e.g. → 0.04,0.19,0.27,0.33,0.54,0.66,0.75,0.99
In: Computer Science
Impact of COVID-19 PANDAMIC, on Middle Eastern economies.
In: Economics
While driving on a highway on a hot day, have you ever seen what appears to be a
In: Physics
Direct Materials, Direct Labor, and Factory Overhead Cost Variance Analysis
Mackinaw Inc. processes a base chemical into plastic. Standard costs and actual costs for direct materials, direct labor, and factory overhead incurred for the manufacture of 5,200 units of product were as follows:
| Standard Costs | Actual Costs | ||
| Direct materials | 6,800 lb. at $6.00 | 6,700 lb. at $5.80 | |
| Direct labor | 1,300 hrs. at $18.00 | 1,330 hrs. at $18.30 | |
| Factory overhead | Rates per direct labor hr., | ||
| based on 100% of normal | |||
| capacity of 1,360 direct | |||
| labor hrs.: | |||
| Variable cost, $2.90 | $3,730 variable cost | ||
| Fixed cost, $4.60 | $6,256 fixed cost | ||
Each unit requires 0.25 hour of direct labor.
Required:
a. Determine the direct materials price variance, direct materials quantity variance, and total direct materials cost variance. Enter a favorable variance as a negative number using a minus sign and an unfavorable variance as a positive number.
| Direct materials price variance | $ | |
| Direct materials quantity variance | ||
| Total direct materials cost variance | $ |
b. Determine the direct labor rate variance, direct labor time variance, and total direct labor cost variance. Enter a favorable variance as a negative number using a minus sign and an unfavorable variance as a positive number.
| Direct labor rate variance | $ | |
| Direct labor time variance | ||
| Total direct labor cost variance | $ |
c. Determine variable factory overhead controllable variance, the fixed factory overhead volume variance, and total factory overhead cost variance. Enter a favorable variance as a negative number using a minus sign and an unfavorable variance as a positive number.
| Variable factory overhead controllable variance | $ | |
| Fixed factory overhead volume variance | ||
| Total factory overhead cost variance | $ |
In: Accounting
discuss on the benefits that Data Dictionaries can bring in the health sector and give an example
In: Computer Science
take the role of mentor to a new project manager within your organization. This assignment focuses on guidance the mentor provides the new project manager regarding cost.
Cost serves several purposes for an organization: (1) planning and budgeting, (2) assisting in decision making, (3) comparing actual to budget (control), and (4) calculating income generated from operations and projects (score-keeping). Select one these areas and prepare a short document outlining the following items:
In: Accounting
cA Christmas tree provider sells trees on Dec. 20th. They sell trees for 5 full days, closing the lot at the end of the day on December 24th. Based on past sales data, they decided to cut down 220 trees for this year's selling season. Each cut tree has a 70% chance of being a healthy tree that a customer would purchase and a 30% chance of being an unhealthy tree that nobody wants to purchase. On each of the 5 selling days, the number of customers who show up prepared to purchase a tree is normally distributed with an average of 30 and a standard deviation of 5.
a) On average, How many healthy trees do they have?
b) What is the likelihood they end up with 168 or more healthy trees?
c) What is the likelihood that 168 customers or more visit to purchase a tree?
d) What is the likelihood that more customers visit over the 5 days than they can provide healthy trees for? (stockout)
e) How many trees do they need to cut down to ensure stocking out is less than or equal to 10%?
f) Suppose it costs $25 for each tree they cut down and healthy trees are sold for $100. Is it better to stick with the 220 tree strategy or change it to what you found in part e?
In: Math
A 0.8027 g sample of impure al2(CO3)3 decomposed with HCL: the
liberated CO2 was collected on calcium oxide and found to weight
0.0507g calculate the percentage of aluminum in the sample
In: Chemistry
Question 2:
Write a Java console application that will allow a user to add contacts to a contact list and view their current contact list sorted alphabetically. Your program should prompt the user to select an action (add or view). If the user chooses to add a contact, the contact information should be entered using the following format: Firstname Lastname, PhoneNumber If the user chooses to view their contact list, your program should display each contact on a separate line using the following format: Firstname Lastname: PhoneNumber Assume that both contact names and phone numbers will be unique (no two contacts can have the same name or phone number. A contact can only have one phone number, and a phone number can only belong to one contact). Create the appropriate objects based on the application description. Select the most suitable data structure(s) for this application.
In: Computer Science
A solution of 0.172 M NaOH is used to neutralize 27.0 mL of a H2SO4 solution.
Part A
If 30.6 mL of the NaOH solution is required to reach the
endpoint, what is the molarity of the H2SO4 solution?
H2SO4(aq)+2NaOH(aq)→2H2O(l)+Na2SO4(aq)
Express your answer with the appropriate units.
|
|
|||
| molarity = | ??? |
Enter your answer using dimensions of chemical concentration
In: Chemistry