Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Project : Program Design

1. Write a C program replace.c that asks the user to enter a three-digit integer and then replace each digit by the sum of that digit plus 6 modulus 10. If the integer entered is less than 100 or greater than 999, output an error message and abort the program. A sample input/output:

Enter a three-digit number: 928

Output: 584

2. Write a C program convert.c that displays menus for converting length and calculates the result. The program should support the following conversions:

Miles Kilometers 1.6093

Kilometers Miles 0.6214

Inches Centimeters 2.54

Centimeters Inches 0.3937

1) Display the menu options as numbers.

1 - Miles to Kilometers

2 - Kilometers to Miles

3 - Inches to Centimeters

4 - Centimeters to Inches

2) Asks the user to select an option. Use a switch statement for option selection.

3) Asks the user to enter the length that's converting from, calculate the result, and display the output. For example, if user selected 1 for option selection, your program is supposed to ask for the number of miles, and display the corresponding kilometers.

4) If the entered option is not in the range of 1 to 4, display an error message and abort the program.

5) The output should display two digits after the decimal point. For example, 3.23.

Before you submit:

1. Compile with -Wall. -Wall shows the warnings by the compiler. Be sure it compiles on circe with no errors and no warnings.

gcc -Wall replace.c

gcc -Wall convert.c

2. Be sure your Unix source file is read & write protected. Change Unix file permission on Unix:

chmod 600 replace.c

chmod 600 convert.c

3. Test your program with the shell script try_replace and try_convert on Unix:

chmod +x try_replace

./try_replace

chmod +x try_convert

./try_convert

4. Download the programs from circe and submit replace.c and convert.c on Canvas>Assignments.

Grading

Total points: 100 (50 points each problem)

1. A program that does not compile will result in a zero.

2. Runtime error and compilation warning 5%

3. Commenting and style 15%

4. Functionality 80%

Programming Style Guidelines

The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works.

1. Your program should begin with a comment that briefly summarizes what it does. This comment should also include your name.

2. In most cases, a function should have a brief comment above its definition describing what it does. Other than that, comments should be written only needed in order for a reader to understand what is happening.

3. Variable names and function names should be sufficiently descriptive that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear.

4. Use consistent indentation to emphasize block structure.

5. Full line comments inside function bodies should conform to the indentation of the code where they appear.

6. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.141592

7. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.

8. Use underscores to make compound names easier to read: tot_vol or total_volumn is clearer than totalvolumn.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M93096686

Have any Question?


Related Questions in C/C++

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As