Categories
C++

What is the output after the code executes?

Question 1
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
True or False
Question 2
Suppose we declare a variable sum as an int. The statement “sum += 7;” is equivalent to the statement “sum = sum + 7;”.
True or False
Question 3
In the following code what is the value of result
int result = 9;
result = result / 2;
Question 4
In the following code what is the value of result
int result = 10;
result = result / 2 + 2;
Question 5
The value ‘$’ can be stored in a char variable?
True or False
Question 6
In the following code what is the value of result
int result = 20;
result = result % 6;
Question 7
The expression
static_cast(9.9)
evaluates to ____.
Question 8
The length of the string “computer science” is ____.
Question 9
The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.
True or False
Question 10
You can use the function getline to read a string containing blanks.
True or False
Question 11
Suppose that x = 55.68, y = 476.859, and z = 23.8216.
What is the output of the following statements
cout << fixed << showpoint;
cout << setprecision(2);
cout << x << ' ' << y << ' ' << z <= 0 && x <= 100) evaluates to false if either x = 100.
True or False
Question 14
What does <= mean?
Question 15
Suppose x is 5 and y is 7. Choose the value of the following expression:
(x != 7) && (x y)
z = x + y;
else
z = y – x;
cout << x << " " << y << " " << z << endl;
Question 17
What is the value of x after the following statements execute?
int x;
x = (5 <= 3 && 'A' < 'F') ? 3 : 4
Question 18
What is the output of the following code?
char lastInitial = 'S';
switch (lastInitial)
{
case 'A':
cout << "section 1" <<endl;
break;
case 'B':
cout << "section 2" <<endl;
break;
case 'C':
cout << "section 3" <<endl;
break;
case 'D':
cout << "section 4" <<endl;
break;
default:
cout << "section 5" <<endl;
}
Question 19
Consider the following code:
string studentName;
cout << "Please enter your name: " <> studentName;
cout << "Your name is " << studentName;
Assume the user types in "Fred Flintstone". What would the output be in the last line
Question 20
Consider the following code:
bool myFlag = true;
string Hello = "greetings";
if(myFlag)
{
cout << Hello;
}
else
{
cout << "Hello";
}
What is the output after the code executes?

Categories
C++

Remove from a list of doubles all the elements that are present multiple times: we consider the list to be sorted.

Implement functions related to the double chained list. These functions should be included in the class.
Remove from a list of doubles all the elements that are present multiple times: we consider the list to be unsorted.
Remove from a list of doubles all the elements that are present multiple times: we consider the list to be sorted.
Create a function that returns, from a list of doubles, a list that contains 2 elements in each node: the value of an element from the list given as an input, and the number of times this element is present in the list given as an output.
Implement the Quicksort algorithm with the lists. We will assume that we know the number of elements that are contained in the list. For each method of the class Double Chained List, provide an example illustrating how the function can be used.
Please do not copy code from the internet, thank you!

Categories
C++

These functions should be included in the class.

Implement functions related to the double chained list. These functions should be included in the class.
Remove from a list of doubles all the elements that are present multiple times: we consider the list to be unsorted.
Remove from a list of doubles all the elements that are present multiple times: we consider the list to be sorted.
Create a function that returns, from a list of doubles, a list that contains 2 elements in each node: the value of an element from the list given as an input, and the number of times this element is present in the list given as an output.
Implement the Quicksort algorithm with the lists. We will assume that we know the number of elements that are contained in the list. For each method of the class Double Chained List, provide an example illustrating how the function can be used.
Please do not copy code from the internet, thank you!

Categories
C++

Write a program that controls the laser system at a medical devices company.

Please read the specifications carefully. The result should match the screenshoot below to get full credit.
I already did half of the assignment. I need help to complete it. I attached the code file below. Please pull the LaserSystem.asm file and continue working on it. Thanks!
INCLUDE Irvine32.inc
.data
control byte 0h
msg0 byte “Medical Laser Syste”, 0
msg1 byte “Start? y/n: “, 0
msg1a byte “system started”, 0
msg2 byte “Standby? y/n: “, 0
msg2a byte “System in standby mode”, 0
msg 2b byte “Standy bit: “, 0
msg3 byte “Ready? y/n: “,0
msg3a byte “System in ready mode”, 0
msg3b byte “Ready bit: “, 0
msg4 byte “Fire? y/n”, 0
msg4a byte “System in fire mode”,0
msg10 byte “Invalid input”, 0
.code
main PROC
mov edx, offset msg0
call WriteString
call crlf
start:
mov edx, offset msg1
call WriteString
call readchar; get the user input yes enter Standby mod
or al, 20h; convert Y it to lowercase letter
cmp al, “y”; cmp if both equal jump to standby
jz standby; jmp to standby mode
cmp al, “n”; cmp uppercase N to n
jz start; if equal jmp to start
jmp invalid
standby:
mov edx, offset msg2a
call writestring
call crlf
mov edx ,offset msg2b
call WriteString
call readInt
ready:
mov edx, offset msg3
call WriteString
call readInt
firing:
mov edx , offset msg4
call WriteString
call readInt
invalid:
mov edx, offset msg10
call Writestring
call crlf
jmp start
exit
main ENDP
end main
Project Description
Write a program that controls the laser system at a medical devices company. The program includes a main procedure which gets user inputs and uses the input values for the OK button press, CANCEL button press, the SET button press, the CLEAR button press, and other functionalities on the touch screen. The program should generate the output which is shown on the sample run/output below.
Specifications
Define a 8-bit control variable and initialize it with 0.
Declare status messages for the program output.
Create a main procedure to get user inputs.
Use ‘y’ for the OK button press and ‘n’ for the CANCEL button press.
Display an error message if user input is neither ‘y’ nor ‘n’.
Note that the system has four different modes: Start, Standby, Ready, and Fire.
Assume the user enters 1 to set the bit and enters 0 to clear the bit.
Set the MSB of the control byte to confirm the laser is in the standby mode.
Set the LSB of the control byte to confirm the laser is in the ready mode.
Make sure the MSB and the LSB of the control variable should be set before firing the laser.
Use the following instructions along with other instructions for your program: CMP, JZ, SHL, RCL, RCR, and OR.
Test the program and generate the output.

Categories
C++

Define prototypes and define the following functions:

Project Instructions
You have been hired by a local smoothie shop to write a program that will calculate the cost of a smoothie order. The shop sells four types of smoothies in three different sizes: Small (20 oz), Medium (32 oz) and Large (40 oz). Your program should use a menu for the type of smoothie and a second menu for the smoothie size. Calculate the total cost of the order including tax and display a bill for the smoothie. See the Sample Output. The sales tax rate is 4.5%. Use named constants to hold the cost per ounce of each of the products and the sales tax rate. Use the constants in your calculations and wherever else they are appropriate in your program.
Product Cost per Ounce Banana $0.62
Strawberry $0.60
Mango $0.48 Blueberry $0.57
modular.
Instead of having one long main function that contains all the statements necessary to solve the problem given in previous projects, you must write several smaller functions that each solve a specific part of the problem. These small functions should then be executed in the correct order to implement a complete solution.
The named constants you used in previous projects should now be made global so you won’t have to pass those values to any function.
In addition to the main function, your code must include the specified functions. These functionss must be written exactly as specified to avoid a major error penalty.
Make sure your program uses the values returned from your functions. Any functions that need input to perform a task will have to accept arguments. Global variables are prohibited.
Steps:
Make all of your named constants global.
Define prototypes and define the following functions:
Function 1 – displayStartMenu
A void function that only displays the first menu. See Sample Output for format.
Function 2 – determineCostPerOz
A double returning function that accepts the user’s menu choice for type of smoothie and returns the price per ounce.
Function 3 – determineNumberOunces
An integer returning function that accepts the user’s menu choice for size of smoothie and returns the number of ounces.
Function 4– calcSmoothieSubtotal
A double returning function that accepts the price per ounce and the number of ounces purchased and returns the price of the smoothie.
Function 5– calcSalesTax
A double returning function that ONLY accepts the price of the smoothie and returns the sales tax.
Function 6– calcCostBill
A double method that accepts the price of the smoothie and the sales tax and returns the total amount owed.
NOTE: All functions must be coded as instructed above. Modifying the functions (meaning adding or removing parameters, changing the return type of the function, etc…) will count as a major error (i.e., one major error deduction for each function that is modified.)
.
The start menu must still give the user the ability to process a single order manually, process multiple orders, or quit the program. For this new menu only, you must validate the user’s menu choice so that only values of 1, 2 or 3 are accepted and users have an unlimited number of chances to enter a valid menu choice. Your program must continue to run until the user chooses the “quit” option from your menu.
sample run video: Previous Project Steps:
Add a menu to offer the user a choice of processing a single order, processing multiple orders, quit the program. This menu should be the first thing displayed when your program begins executing. The menu format should match the one in the Sample Output. Allow the user to continue making menu choices until they choose the option to quit. Always display the menu before prompting the user for a menu option. Properly handle an invalid menu choice. The user should have an unlimited number of chances to enter a valid menu choice.
Add functionality to display randomly generated smoothie orders. When the user selects the option to process multiple orders, bills should be created and displayed for every entry. The user should be asked to enter the number of orders they would like to make, then random numbers should be used to generate the smoothie type and the size. Each bill generated should display the order number, smoothie type for the order, the size of the smoothie, the subtotal of the smoothie, the sales tax for the smoothie, and the total cost for the order. See the Sample Output for what each bill must contain. The example contains 5 records, but your program must be able to process any number of records based on the number of orders the user chooses. Validate the input of the number of orders so that the user must enter at least 1 order and no more than 10 orders. Give the user an unlimited amount of chances to enter the a valid number of order

Categories
C++

Do not use any array for this program, but keep the 9 square content variables as in the previous program.

You will be modifying your 2 previous programs: tic-tac-toe and calculator code. Be sure to correct any errors or items noted on the programs or in the Gradebook.
1. For the tic-tac-toe program, you will create a loop in the main routine that will allow the users (assume 2) to play a full game of tic-tac-toe, alternating between X’s and O’s. [Note, you are not limited to a single loop in main.] Use the same 1-9 board from the previous version. You must force each user to specify an unoccupied square.
Write a function that can determine if there is a winner, or if the game is a draw (no winner, but all 9 squares have been selected). DO NOT use any array for this program, but keep the 9 square content variables as in the previous program.
When the game is over, use another new function to see if the users want to play again by answering either y or n (must force the user to provide a valid input and this input must be a char variable). If ‘y’ is selected then repeat the game, until a ‘n’ is selected following any game.
The output for this program should show 2 complete games prior to a user selecting to quit and you must demonstrate your square selection and game continuation error checking at some point during the games!
2. For the calculator program, you will only be performing a single mathematical operation at a time, similar to switch version of this program, but you must include a function that allows the user to specify they want to continue performing mathematical operations. Use a loop in main to permit multiple operations to be performed sequentially. Force the user to specify a correct value. This is nearly identical to the continuation functionality you built for the tic-tac-toe program.
The 2 operands specified for each operation (as 2 new ones will be needed for each new operation) will remain integer values.
You will also be adding an exponent function to the calculator (as a 7th operator), use the symbol ^ to specify exponentiation. Your function should calculate an exponent using only addition and multiplication with loops. DO NOT use the exp or other built-in exponent function, but write your own as specified.
Make sure your calculator output shows each operator including your new exponent operator, being executed as well as error checking for the continuation function and the division and modulus operators.

Categories
C++

3 assignments using the program devc++ these assignments should be quick and eas

3 assignments using the program DevC++
These assignments should be quick and easy for someone that is familiar with C++
Assignment 1: https://www.evernote.com/shard/s546/sh/60b528ea-aa28-74d5-c5c1-b0169fac6092/630f3f3845cbc6cb41c5362c63a8c7f6
Assignment 2: https://www.evernote.com/shard/s546/sh/cee6abdd-7607-226c-c5e8-442801c56880/68c231f8cd2b86bd4b56cc605584ee97
Assignment 3: https://www.evernote.com/shard/s546/sh/1f313772-8d10-c565-9370-2bd799bd15c9/b8c43eb0c75d1420fe07d6ed92cb9091
Relevant info:
Aidan Verastegui
7592 Jbsa Lackland, San Antonio, Texas, 78212

Categories
C++

How is it read in?

….Attention: Do not need the whole assignment you can just do the functionality of commercial and industrial…..comment and code please
Project 1: SimCity
Instructions
For this project, you and your group will be designing and implementing a system in C or C++, that will simulate the growth of a city over time. Specifically, you will be simulating the growth of residential, commercial, and industrial zones, and seeing how pollution impacts the overall development.
Details:
Sample input files will be provided on Canvas. You can copy input the files from there.
Further, you will need to utilize the GitLab code repository located at https://computerscience.engineering.unt.edu/csegit…. You may access it from the website, the terminal, or an IDE of your choice.
Also, as a reminder, all of the work for this project must be the sole product of the group. You may not:
share code with other groups, or download solutions off the internet, as doing so will be considered cheating. If you are struggling with a concept or implementation, you are encouraged to contact the TA’s/IA’s in your recitation for aid.
Requirements
This assignment has two parts: a wiki portion and an implementation portion.
WikiFor the wiki portion, the group must generate documentation describing their system using the wiki functionality provided by GitLab. The wiki must contain at least one page that provides a high-level description of the entire system, and must contain at least one page for each of the major functionality components (i.e. if there are six major functionality components, there should be at least six pages). For the high-level description page, the team must provide a brief description of: each of the major functionality components, how they work together, and some of the major data structures across the entire project. This information should not be copied and pasted from the project instructions. The page must also contain a diagram of the entire system, based on the one created during recitations. The diagram must be created digitally (i.e. using PowerPoint, Photoshop, Paint.net, UMLet, etc.), must be easy to read and understand, and cannot be a photographed or scanned image. For each major functionality component page, the student accountable for that component must provide a detailed description of their component. This description should have three labeled sections: a brief description of the purpose of the component, a description of how data was stored and maintained for this component, and a description of the functionality for the component. They might also consider including diagrams to more easily visualize how all of the pieces fit together.
For the data storage and maintenance section, there should be an explanation of how data was stored and maintained in their component. What, if any, objects or structs were created to store data? How were they organized and managed? What types of formal data structures did were made use of (trees, graphs, arrays, hashes, etc)? For the functionality component, there should be an explanation of the major functions in the component. How is data moved and transformed? How is it read in? How is it output? What are the various major functions constructed and how do they work? Descriptions and explanations should be primarily in prose and paragraph format, not bulleted lists. Code snippets are also acceptable but must be used as an enhancement to the explanation of functionality not as a substitution for it. Your grade for the wiki will partly be based on apparent effort, so please be thorough in your descriptions. Additionally, because this is a wiki, the high-level description page must have links to all of the major functionality component pages.
ImplementationYour program must provide the following functionality and adhere to the following constraints:
Your int main() should be in its own .c/.cpp file
All .c/.cpp files, except your main.c/main.cpp, must have associated header files. You may not #include a .c/.cpp file, only header files
Allow the user to input the file containing the simulation configuration
Do NOT hardcode the filename into your program
The first line will provide the name of the file containing the region layout (Do NOT prompt the user for this filename)
The second line will provide the maximum amount of time steps the simulation can take
The third line will provide the refresh rate of how often the current state of the region should be output to the user during simulation
Your system should perform the following operations:
Read in and store the simulation configuration information
Read in and store the initial region layout
The file will be in CSV format
The region may be any sized rectangle
The region contains 0 pollution at the beginning of the simulation
R represents a residential zone
I represents an industrial zone
C represents a commercial zone
– represents a road
T represents a powerline
# represents a powerline over a road
P represents a power plant
Output the initial region state
If a cell is zoned residential, industrial, or commercial and has a population of 0, the letter representing the zone type should be displayed instead of its population
The initial region state can be interpreted as time step 0
Simulate the development of the city over time
The simulation should halt when there is no change between two, consecutive time steps or when the time limit has been reached, whichever comes first
The current time step, number of available workers, and number of available goods should be output for each timestep except time step The state of the region should be output at the frequency denoted by the refresh rate in the configuration file
The region is considered to be flat, and thus the edges do not wrap around to connect to each other
Two cells are considered adjacent if they share an edge or corner (i.e. a cell may be adjacent to a maximum of eight other cells, and a minimum of three other cells)
Each of the zoned cells will change their state according to the provided rules
In the event of a decision needing to be made over two zoned cells that could grow and use available resources, the following rules must be used in order:
Commercial zoned cells are prioritized over industrial zoned cells one
The growth of larger population zoned cells is prioritized over smaller population zoned cells (i.e. a 1 population cell will always grow before a 0 population cell) The growth of zoned cells with greater total adjacent populations is prioritized over zoned cells with smaller total adjacent populations
The growth of zoned cells with smaller Y coordinates is prioritized over zoned cells with greater Y coordinates, assuming the top left cell is 0,0
The growth of zoned cells with smaller X coordinates is prioritized over zoned cells with greater X coordinates, assuming the top left cell is 0,0
Residential
If a cell has a population of 0 and is adjacent to a powerline in the current time step, that cell’s population will increase by 1 in the next time step
If a cell has a population of 0 and is adjacent to at least one cell with a population of at least 1, that cell’s population will increase by 1 in the next time step
If a cell has a population of 1 and is adjacent to at least two cells with a population of at least 1, that cell’s population will increase by 1 in the next time step
If a cell has a population of 2 and is adjacent to at least four cells with a population of at least 2, that cell’s population will increase by 1 in the next time step
If a cell has a population of 3 and is adjacent to at least six cells with a population of at least 3, that cell’s population will increase by 1 in the next time step
If a cell has a population of 4 and is adjacent to at least eight cells with a population of at least 4, that cell’s population will increase by 1 in the next time step
The residential population provides workers to the industrial and commercial zones, but each worker can only have one job
Industrial
If a cell has a population of 0, is adjacent to a powerline in the current time step, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 0, is adjacent to at least one cell with a population of at least 1, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 2, is adjacent to at least four cells with a population of at least 2, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
A cell produces pollution equal to its population, and pollution spreads to all adjacent cells at a rate of one less unit of pollution per cell away from the source
The industrial population provides goods to the commercial zones, at a rate of one good per population, but each good can only be sold at one commercial cell
Commercial
If a cell has a population of 0, is adjacent to a powerline in the current time step, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
If a cell has a population of 0, is adjacent to at least one cell with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
Output the final region state
Output the total, regional population for residential zones, industrial zones, and commercial zones
Output the final regional pollution state
Output the total pollution in the region
Prompt the user for the coordinates of some rectangular area of the region to analyze more closely
You must perform bounds checking to make sure the coordinates are within the bounds of the region, and re-prompt the user if their coordinates are outside the bounds
Output the total population for residential zones, industrial zones, and commercial zones within the area specified by the user
Output the total pollution within the area specified by the user
See the example output files for formatting of each of the outputs
Major functionality components must be constructed in some function, or across some functions, that are declared and defined outside of your main.c/main.cpp . Remember, function declarations must be stored in a header file, while definitions must be stored in a .c/.cpp file. You may have additional functions that support your major functionality component function.
Your code must be well commented.
Each group member should be performing regular commits to the GitLab repository on the Apollo server with meaningful commit messages. “Fixed bug” or “New code” are not meaningful, so try to be more specific about what was fixed or what was added.
Please do not commit the example input and output files to the remote server as that may cause a space issue on the server.
You must provide a .txt format README file which includes:
The names of all group members
Instructions on how to compile your program
Instructions on how to run your program
An indication on whether you implemented the bonus or not. By default, the TA’s will assume you did not attempt the bonus unless you indicate otherwise. Additionally, you may write a makefile, but please specify if it needs any additional flags to function properly
Each student must be accountable for one or more major functionality components and may not swap after they sign up for a component barring an exceptional circumstance. Failure to be accountable for any major functionality component will result in a 0 for the coding portions of the project (milestone submission and/or final submission). Keep in mind that some components build on others, so be careful about who takes ownership of which pieces and manage your time to avoid a crunch near the due date. Also, the group should strive to balance the work across all members.
The major functionality components are:Reading in the configuration file and region file, and initializing the simulation
Residential zone functionality (i.e. data storage, rules, transformations)
Commercial zone functionality (i.e. data storage, rules, transformations)
Industrial zone functionality (i.e. data storage, rules, transformations)
Pollution functionality (i.e. data storage, rules, transformations)
Analysis of the region and desired area (i.e. outputs, totals)
Milestone Project Submission
Your program must provide all requested functionality for major functionality component 1 (reading in the configuration file and region file, and initializing the simulation), as well as being able to output the initial region state. At least one group member must submit a .zip file containing the following:
1. All files necessary to compile and run your program (Please do not include any files not necessary to run the program on the CSE machines) 2. A .txt format README file explaining how to compile and run your program
Final Project Submission
Your program must provide all requested functionality. At least one group member must submit a .zip file containing the following:
1. All files necessary to compile and run your program (Please do not include any files not necessary to run the program on the CSE machines) 2. A .txt format README file explaining how to compile and run your program

Categories
C++

What types of formal data structures did were made use of (trees, graphs, arrays, hashes, etc)?

Project 1: SimCity
Instructions
For this project, you and your group will be designing and implementing a system in C or C++, that will simulate the growth of a city over time. Specifically, you will be simulating the growth of residential, commercial, and industrial zones, and seeing how pollution impacts the overall development.
Details:
Sample input files will be provided on Canvas. You can copy input the files from there.
Further, you will need to utilize the GitLab code repository located at https://computerscience.engineering.unt.edu/csegit…. You may access it from the website, the terminal, or an IDE of your choice.
Also, as a reminder, all of the work for this project must be the sole product of the group. You may not:
share code with other groups, or download solutions off the internet, as doing so will be considered cheating. If you are struggling with a concept or implementation, you are encouraged to contact the TA’s/IA’s in your recitation for aid.
Requirements
This assignment has two parts: a wiki portion and an implementation portion.
WikiFor the wiki portion, the group must generate documentation describing their system using the wiki functionality provided by GitLab. The wiki must contain at least one page that provides a high-level description of the entire system, and must contain at least one page for each of the major functionality components (i.e. if there are six major functionality components, there should be at least six pages). For the high-level description page, the team must provide a brief description of: each of the major functionality components, how they work together, and some of the major data structures across the entire project. This information should not be copied and pasted from the project instructions. The page must also contain a diagram of the entire system, based on the one created during recitations. The diagram must be created digitally (i.e. using PowerPoint, Photoshop, Paint.net, UMLet, etc.), must be easy to read and understand, and cannot be a photographed or scanned image. For each major functionality component page, the student accountable for that component must provide a detailed description of their component. This description should have three labeled sections: a brief description of the purpose of the component, a description of how data was stored and maintained for this component, and a description of the functionality for the component. They might also consider including diagrams to more easily visualize how all of the pieces fit together.
For the data storage and maintenance section, there should be an explanation of how data was stored and maintained in their component. What, if any, objects or structs were created to store data? How were they organized and managed? What types of formal data structures did were made use of (trees, graphs, arrays, hashes, etc)? For the functionality component, there should be an explanation of the major functions in the component. How is data moved and transformed? How is it read in? How is it output? What are the various major functions constructed and how do they work? Descriptions and explanations should be primarily in prose and paragraph format, not bulleted lists. Code snippets are also acceptable but must be used as an enhancement to the explanation of functionality not as a substitution for it. Your grade for the wiki will partly be based on apparent effort, so please be thorough in your descriptions. Additionally, because this is a wiki, the high-level description page must have links to all of the major functionality component pages.
ImplementationYour program must provide the following functionality and adhere to the following constraints:
Your int main() should be in its own .c/.cpp file
All .c/.cpp files, except your main.c/main.cpp, must have associated header files. You may not #include a .c/.cpp file, only header files
Allow the user to input the file containing the simulation configuration
Do NOT hardcode the filename into your program
The first line will provide the name of the file containing the region layout (Do NOT prompt the user for this filename)
The second line will provide the maximum amount of time steps the simulation can take
The third line will provide the refresh rate of how often the current state of the region should be output to the user during simulation
Your system should perform the following operations:
Read in and store the simulation configuration information
Read in and store the initial region layout
The file will be in CSV format
The region may be any sized rectangle
The region contains 0 pollution at the beginning of the simulation
R represents a residential zone
I represents an industrial zone
C represents a commercial zone
– represents a road
T represents a powerline
# represents a powerline over a road
P represents a power plant
Output the initial region state
If a cell is zoned residential, industrial, or commercial and has a population of 0, the letter representing the zone type should be displayed instead of its population
The initial region state can be interpreted as time step 0
Simulate the development of the city over time
The simulation should halt when there is no change between two, consecutive time steps or when the time limit has been reached, whichever comes first
The current time step, number of available workers, and number of available goods should be output for each timestep except time step The state of the region should be output at the frequency denoted by the refresh rate in the configuration file
The region is considered to be flat, and thus the edges do not wrap around to connect to each other
Two cells are considered adjacent if they share an edge or corner (i.e. a cell may be adjacent to a maximum of eight other cells, and a minimum of three other cells)
Each of the zoned cells will change their state according to the provided rules
In the event of a decision needing to be made over two zoned cells that could grow and use available resources, the following rules must be used in order:
Commercial zoned cells are prioritized over industrial zoned cells one
The growth of larger population zoned cells is prioritized over smaller population zoned cells (i.e. a 1 population cell will always grow before a 0 population cell) The growth of zoned cells with greater total adjacent populations is prioritized over zoned cells with smaller total adjacent populations
The growth of zoned cells with smaller Y coordinates is prioritized over zoned cells with greater Y coordinates, assuming the top left cell is 0,0
The growth of zoned cells with smaller X coordinates is prioritized over zoned cells with greater X coordinates, assuming the top left cell is 0,0
Residential
If a cell has a population of 0 and is adjacent to a powerline in the current time step, that cell’s population will increase by 1 in the next time step
If a cell has a population of 0 and is adjacent to at least one cell with a population of at least 1, that cell’s population will increase by 1 in the next time step
If a cell has a population of 1 and is adjacent to at least two cells with a population of at least 1, that cell’s population will increase by 1 in the next time step
If a cell has a population of 2 and is adjacent to at least four cells with a population of at least 2, that cell’s population will increase by 1 in the next time step
If a cell has a population of 3 and is adjacent to at least six cells with a population of at least 3, that cell’s population will increase by 1 in the next time step
If a cell has a population of 4 and is adjacent to at least eight cells with a population of at least 4, that cell’s population will increase by 1 in the next time step
The residential population provides workers to the industrial and commercial zones, but each worker can only have one job
Industrial
If a cell has a population of 0, is adjacent to a powerline in the current time step, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 0, is adjacent to at least one cell with a population of at least 1, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
If a cell has a population of 2, is adjacent to at least four cells with a population of at least 2, and there are at least 2 available workers, that cell’s population will increase by 1 in the next time step and the available workers are assigned to that job
A cell produces pollution equal to its population, and pollution spreads to all adjacent cells at a rate of one less unit of pollution per cell away from the source
The industrial population provides goods to the commercial zones, at a rate of one good per population, but each good can only be sold at one commercial cell
Commercial
If a cell has a population of 0, is adjacent to a powerline in the current time step, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
If a cell has a population of 0, is adjacent to at least one cell with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell’s population will increase by 1 in the next time step and the available worker and available good are assigned to that job
Output the final region state
Output the total, regional population for residential zones, industrial zones, and commercial zones
Output the final regional pollution state
Output the total pollution in the region
Prompt the user for the coordinates of some rectangular area of the region to analyze more closely
You must perform bounds checking to make sure the coordinates are within the bounds of the region, and re-prompt the user if their coordinates are outside the bounds
Output the total population for residential zones, industrial zones, and commercial zones within the area specified by the user
Output the total pollution within the area specified by the user
See the example output files for formatting of each of the outputs
Major functionality components must be constructed in some function, or across some functions, that are declared and defined outside of your main.c/main.cpp . Remember, function declarations must be stored in a header file, while definitions must be stored in a .c/.cpp file. You may have additional functions that support your major functionality component function.
Your code must be well commented.
Each group member should be performing regular commits to the GitLab repository on the Apollo server with meaningful commit messages. “Fixed bug” or “New code” are not meaningful, so try to be more specific about what was fixed or what was added.
Please do not commit the example input and output files to the remote server as that may cause a space issue on the server.
You must provide a .txt format README file which includes:
The names of all group members
Instructions on how to compile your program
Instructions on how to run your program
An indication on whether you implemented the bonus or not. By default, the TA’s will assume you did not attempt the bonus unless you indicate otherwise. Additionally, you may write a makefile, but please specify if it needs any additional flags to function properly
Each student must be accountable for one or more major functionality components and may not swap after they sign up for a component barring an exceptional circumstance. Failure to be accountable for any major functionality component will result in a 0 for the coding portions of the project (milestone submission and/or final submission). Keep in mind that some components build on others, so be careful about who takes ownership of which pieces and manage your time to avoid a crunch near the due date. Also, the group should strive to balance the work across all members.
The major functionality components are:Reading in the configuration file and region file, and initializing the simulation
Residential zone functionality (i.e. data storage, rules, transformations)
Commercial zone functionality (i.e. data storage, rules, transformations)
Industrial zone functionality (i.e. data storage, rules, transformations)
Pollution functionality (i.e. data storage, rules, transformations)
Analysis of the region and desired area (i.e. outputs, totals)
Milestone Project Submission
Your program must provide all requested functionality for major functionality component 1 (reading in the configuration file and region file, and initializing the simulation), as well as being able to output the initial region state. At least one group member must submit a .zip file containing the following:
1. All files necessary to compile and run your program (Please do not include any files not necessary to run the program on the CSE machines) 2. A .txt format README file explaining how to compile and run your program
Final Project Submission
Your program must provide all requested functionality. At least one group member must submit a .zip file containing the following:
1. All files necessary to compile and run your program (Please do not include any files not necessary to run the program on the CSE machines) 2. A .txt format README file explaining how to compile and run your program

Categories
C++

Do not write a program.

Write a function to compute the total cost of an order for a luggage shop. Each order should contain the luggage size (‘L’, ‘M’, ‘S’) and the number of luggage ordered for the size. Size ‘L’ luggage costs $154.99, size ‘M’ luggage costs $122.95 and size ‘S’ luggage costs $79.99 each. Naturally the function should take two parameters: a luggage size and the number of luggage. It should compute the total cost (excluding tax) and return it as function value. The total cost must include possible delivery charge as follows: for order of $200 or more: no delivery charge. Otherwise the deliver charge would be $25 added to the total cost.
You need to provide function declaration, function definition and an example of how the function can be called/invoked. Do not write a program. Just a fragment of code.
Lastly, think about efficiency when determining the luggage cost per size.