Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction to C Programming COP 3223 Objectives 1. To give students practice at typing in, compiling and running simple programs. 2. To reinforce knowledge of

Introduction to C Programming COP 3223

Objectives

1. To give students practice at typing in, compiling and running simple programs.

2. To reinforce knowledge of assignment statements and arithmetic expressions

3. To learn how to use if statements for conditional execution.

Introduction: Who doesnt love dragons?

Movies about dragons and dragon training were very popular this summer. Your friend has not stopped talking about how awesome dragons are and how cool it would be to train them. To amuse your friend, you have decided to create a series of programs about dragons.

Problem: Dragon Nap Time (dragonresting.c)

Baby dragons, like babies of all species, needs lots of rest. Young dragons are very active learning to fly, shoot fire, and terrorize villages. Their level of activity determines how much rest they need to recuperate. In this program, we will determine how many hours and minutes a dragon needs to rest after his or her day of learning.

You will need to ask the user for the number of minutes the dragon was active. The dragon then needs to rest for 2.5 times that amount. You will then tell the user how many minutes of rest are required.

However, if your user has a lazy dragon they might not have spent any time being active. In that case, you should remind the user that dragons need training and exercise to realize their full potential.

Input Specification

1. The number of minutes of activity will be a positive integer less than 1000.

Output Specification

If the dragon needs to rest:

Your dragon should rest for X hours and Y minutes.

If the dragon does not need to rest:

Your dragon should spend more time training.

Output Sample

Below are some sample outputs of running the program. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above.

In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for claritys sake.)

Sample Run #1

How long was your dragon active for?

100

Your dragon should rest for 4 hours and 10 minutes.

Sample Run #2

How long was your dragon active for?

48

Your dragon should rest for 2 hours and 0 minutes.

Sample Run #3

How long was your dragon active for?

0

Your dragon should spend more time training.

Deliverables

One source files dragonresting.c is to be submitted over WebCourses.

Restrictions

Although you may use other compilers, your program must compile and run using Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include comments throughout your code describing the major steps in solving the problem.

Grading Details

Your programs will be graded upon the following criteria:

1) Your correctness

2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade.

3) Compatibility You must submit C source files that can be compiled and executed in a standard C Development Environment. If your program does not compile, you will get a sizable deduction from your grade.

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago