A1

pdf

School

Arizona State University *

*We aren’t endorsed by this school

Course

100

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

4

Uploaded by ChefClover20268

Report
Assignment 1 - Due on Jan. 27 CSE 100 Assignment # 1 Maximum Points: 20 NO LATE ASSIGNMENTS WILL BE ACCEPTED. Due Date: January 27the by 11:59PM Your assignments must be submitted to GradeScope. The link is available from the CSE100 course website. Your programming assignments require individual work and effort to be of any benefit. Every student must work independently on his or her assignments. You must work alone on the assignments no collaboration of any kind is permitted. You cannot use Google, StackOverflow, Chegg, or any other online resources to look up the solution. You should not have an account with websites such as Chegg or CourseHero. Sharing your assignments with others in any way is NOT permitted. Violations of the University's Academic Integrity policy will not be ignored. Violations of the University's Academic Integrity policy will not be ignored. The university academic (https://provost.asu.edu/academic-integrity) Topics: o Understanding topics in chapters 2 &3 Writing arithmetic expression good design formatting appropriate use of getline() and cin.ignore() Assignments Documentation: At the beginning of each programming assignment you must have a comment block with the following information: [ / AUTHOR: your name /l FILENAME: title of the source file /l SPECIFICATION: description of the program // YOUR Lab Letter and Name of the TA for your lab /l FOR: CSE 100- homework #- days and time of your class /l TIME SPENT: how long it took you to complete the assignment Il */ Reasonably good amount of comments should be added in your program so that it is easy for other people to understand it. Important Note: All submitted assignments must begin with the descriptive comment block similar to the one shown above. It must contain your name and lab letter, and the other information illustrated. To avoid losing trivial points, make sure this comment header is included in every assignment you submit, and that it is updated accordingly from assignment to assignment. Part 1: Written Exercises: (6 points)
Note: The answers to the following questions should be typed in the block of comments in the As Please make sure they're commented out (green). Type them neatly and make them easy to read for the the answers 1. Name five data types and what kind of data are they used for. (1 pt) 2. Write next to each statement whether or not it is correct. If it's incorrect, write a correct version of the char key = c; rate * hours = pay; record = "Dental” cout >> the number of squares is >> num_of _squares; 3. What header file must be included: ( 2pts) To use mathematical function like sqrt? To use cout and cin? To use formatting such as setprecision, showpoint? To use string to ask for someone’s name? 4. Mixing cin >> and cin.get can cause problem. (1 pt) Explain the problem with the following code and write the code to fix it: char ch; int number; cout << "Enter a number: "; cin >> number; cout << "enter a character: "; cin.get(ch); cout << "Thank you! \n"; Part 2: Programming (14 points) A movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes tc program that calculates a theater’s gross and net box office profit for a night. The program should ask for movie, and how many adult and child tickets were sold. The price of an adult ticket is $6.00 and a child’s should display a report similar to the one shown below. Assume that the theater keeps 20 percent of the gross box office profit. The first thing to do is plan out your program with some pseudocode. The program can be easily brokel parts: gathering data from the user, calculating the information, and displaying the calculated data. NOTE: 1. When you write your program, your output should look very similar to the sample output. You may us the headings, for the instructions to the user, etc. The exact spacing is not important. What is importa looks good and the decimals and columns align. 2. Use identifiers which are descriptive. One-letter variable names should not be used. As an example, i a discount, the variable needed might be declared using the following statement: double discountPrice; // price after the discount The major purposes of this assignment are to demonstrate: o good design ¢ good programming practices, including internal comments o formatting of decimal points and alignment of columns o appropriate use of getline() and cin.ignore()
Assumptions: The user will enter name of the movie first and then ask for the number of tickets sold The user will only enter numerical input when numerical input is requested Program requirements and/or constraints: Create your plan BEFORE you begin to write the code See the sample output for formatting. Blank lines, spaces, and formatting are important in the output « program. For this assignment your format should closely match the sample output. Use iomanip features to format rather than using spaces. Tickets purchased are shown with no decimal places while gross profit, amount paid and net profit ar: decimal places. Use comments freely throughout the program Use at least 2 constants. No global variables allowed! (-5 points) Your program must work for any valid input - not just the values shown in the sample output. Input val valid if and only if they are non-negative integers. Note that your program will not check if the input de Do not use material beyond the current topic Do your own work. Sample runs: User input is represented by [ ]. Name of the movie: Harry Potter and The Deathly Number of adult tickets sold: 125 Number of child tickets sold: 78 Revenue Report Movie Name: "Harry Potter and The Deathly” Adult Tickets Sold: 125 Child Tickets Sold: 78 Gross Box Office Profit: $ 984.00 Amount Paid to Distributor: - $ 787.20 Net Box Office Profit: $ 196.80 Name of the movie: Social Network Number of adult tickets sold: 98 Number of child tickets sold: 12 Revenue Report Movie Name: "Social Network™ Adult Tickets Sold: 98 Child Tickets Sold: 12 Gross Box Office Profit: $ 624.00 Amount Paid to Distributor: - $ 499.20 Net Box Office Profit: $ 124.80 Grading criteria: Written exercises (part 1) - (6 pts) no partial credit Programming: (14 points) 4 pts - Documentation & indentation & spacing(header with your name, your information, and program de comments within your code) 2 pts - Output (easy to read) 2 pts- Used constants with correct convention & meaningful variable names 6 pts - correct outputs/results 20 points total
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Submit your homework by following the instructions below: *kkkkhkhkkikkihkkhkhhkhkkhhhkhkhkkkhkhkkkhkikkhkkkhhkhhkhkhhhkkhkkkkkhkhkkkhkkhkhkikhkhkkhkhkhhkkik Go to our course website and log onto Canvas, https://my.asu.edu 1. From the left-hand side control panel, click on "Gradescope", it will bring you to Gradescope website, 2. Once inside the Gradescope, from the left hand side, click on Assignments, you will notice that Assigr posted, click on Assignment 1. 3. "Click to browse" to find where you saved the Assignment1.cpp file. cpp should have the following, in 1. In comments, the assignment Header described in "Important Note". 2. The answers to part 1 should be included and commented out 3. The working C++ code requested in Part 2. 4. "Upload" button located at the bottom to submit. If you submit the correct file and your program compiles successfully and generate the expected outp green message with 6 pts assigned automatically. If not, you need to edit your source code and click "Resubmit" button to re-submit your assignment file. 5. For all labs and assignments, you have unlimited times to resubmit before the due date and time. Grz record your last submission! 6. To pass the two auto test cases on Gradescope, your program's output need to be the same as our s space doesn't count, only characters count), we recommend that you use a file comparison program, the following online one to check whether they contains the same outputs or not. 7. The remaining points will be checked and assigned by our graders manually after the assignment’s d 8. Note: It's your responsibility to make sure you submit the source codes correctly and promptly, TA, gr. NOT reply and accept any late submissions through emails! Copyright © 2023 Arizona State University All rights reserved. ASU disclaimer _(http://www.asu.edu/asuweb/disclaimer/)