Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is (C programing) can you guys do it than explain it Q1: (Find the Errors) (15 points) The only way to get good at

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
this is (C programing)
can you guys do it than explain it
Q1: (Find the Errors) (15 points) The only way to get good at finding errors is lots of practice, and with each chapter there are more kinds of syntax errors to look for. Find all the errors in the code below so that it produces the correct output. Code: #include int Main (void) { int salesAmount; // Get First Sales Amount puts (""); printf("%s", "Enter sales in dollars (-1 to end) : $"); scanf("%d", &salesAmount); while (salesAmount == - 1); { printf ("Salary is: $%.2f ", 200.0 + (.09 * salesAmount)); printf("%s", "Enter sales in dollars (-1 to end): $"); scanf("%f", salesAmount); return 0; // Add comments at the end of your program identifying what your changed 1/ Changed ... 1/ Changed ... Sample Input and Output: Enter sales in dollars (-1 to end): $1234 Salary is: $311.11 Enter sales in dollars (-1 to end) : $958 Salary is: $1062.85 Enter sales in dollars (-1 to end): 9-1 Q2: (Integer Sequences with While Loops) (25 points): Loops are very useful for counting and generating sequences of integers. If you can use a variable with a loop to count from 0 to n, then you can often transform that variable n using a formula or function such that f(n) results in a new integer sequence. Write a program that prompts the user to enter a number between 2 and 20, and then uses a series of while loops to generate some interesting integer sequences. The loop counters should all start at zero, but the transformed number may start at a number other than zero. The exact prompts and outputs needed can be found in the sample output given below. Use 2 spaces between each integer printed. Your program output should look as follows: Sample Input and Output: Enter a number between 2 and 20: 8 The first 8 whole numbers: 0 1 2 3 4 5 6 7 The first 8 even whole numbers: 0 2 4 6 8 10 12 14 The first 8 odd whole numbers: 1 3 5 7 9 11 13 15 The first 8 whole numbers counting by 7:0 7 14 21 28 first 8 perfect squares: 0 1 4 9 16 25 36 49 35 42 49 The For more information about integer sequences, look at the On-Line Encyclopedia of Integer Sequences found at https://es.org (external link), which documents over 250,000 integer c a . Q3: (Tipping Chart) (15 points): A very popular application on cell phones is a tip amount calculator. Write a program that takes as input the total amount of a restaurant bill. Then use a while loop to generate a chart of tip amounts for each percentage from 10% to 25%. Show the amount of the tip along with the total bill with the tip amount included. Below is a sample set of input and output for your program: Sample input and output: Enter the total restaurant charge: $19.27 ------Tipping Chart--- Percent Tip Total 10% $1.93 $21.20 11% $2.12 $21.39 12% $2.31 $21.58 139 $2.51 $21.78 14% $2.70 $21.97 15% $2.89 $22.16 16% $3.08 $22.35 17% $3.28 $22.55 18% $3.47 $22.74 19% $3.66 $22.93 208 $3.85 $23.12 21% $4.05 $23.32 22% $4.24 $23.51 238 $4.43 $23.70 24% $4.62 $23.89 25% $4.82 $24.09 Note: To print an % symbol, use %% in the printf format string. The $ is part of the prompt, and not entered by the user. Caution: Float data types are converted to binary when stored, and slight inaccuracies can often result because of this conversion. Never use a float in a comparison condition of a while statement! Q4: (A Better Simple Interest Loan Calculator) (20 points): The simple interest on a loan is calculated by the formula: interest - principal rate * days / 365; The preceding formula assumes that rate is the annual interest rate, and therefore includes the division by 365 (days). Develop a program that will input principal, rate and days for several loans, and will calculate and display the simple interest for each loan, using the preceding formula. Use a sentinel value with a while loop to calculate the simple interest on as many loans as desired until the sentinel value is entered The exact prompts for your program can be found in the output below that your program should produce Enter loan principal (-1 to end): 1000.00 Enter annual interest rate: .1 Enter term of the loan in days: 365 The interest charge is $100.00 Enter loan principal (-1 to end): 1000.00 Enter annual interest rate: .08375 Enter term of the loan in days: 224 The interest charge is $51.40 Enter loan principal (-1 to end): -1 Q5: (Flowchart: Tax Return) (25 points) This flowchart allows a single person to determine if he or she needs to file an income tax return. Develop an application that ask user the questions in the flowchart and show the user an appropriate message. The output should be similar to output below. Are you single? Do You Have To File an Income Tax Return? You have to choose form FABC Yes Are you under 65 years Is your income less than is your gross Income less than have to lean L Sample Inputs and Outputs: Do You Have to File an Income Tax Return? Note: Please answer the following questions carefully. If you made a mistake in answering the questions, please restart the program and start answering the questions. Use 1 to say "Yes"_and @ to say "No. Please answer the following questions: Are you single? 1 Are you under 65 years of age? 1 Is your gross income less than $8450? 1 You do not have to file an income tax. 4.00 3.25 Q6: (GPA Calculator - Extra credit) (15 points): Figure 3.8 in the textbook provides code that allows a user to enter a list of grades in number format, and then it displays the letter grade for the number and calculates the average grade for the class. Modify this code so that it becomes a GPA calculator. You will find the nested if..else if code example in the textbook on page 78 that also uses numerical grades to be very useful. Merge the two code examples of the textbook, adding some prompts for the amount of semester hours per grade, and some variables to keep up with total GPA points earned and total semester hours taken. Use the following chart of GPA point values: Number Grade Letter Grade GPA Points per Semester Hour 93-100 90 - 92 86-89 83-85 80 - 82 76 - 79 73 - 75 70 - 72 66 - 69 1.25 63-66 1.00 60-62 0.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions