Question

This is for an entry level C++ course. Having trouble understanding what the question is really asking. Thank a ton to whoever can help.

Given an analog clock (displayed in a circle) with minutes on the big hand, and hour on the small hand. Take in as input a number between 0 and 11 (including zero and 11). Then the second number determines how many minutes have passed. Print out where the big hand will be after that many minutes going clockwise, then print out where the big hand will be after that many minutes going counter-clockwise. Ex: If the input is 2 5, the output is: If you start at 2 minutes and add 5 (clockwise), you will be at minute 7. To go counter clockwise, we have to realize that we are already 2 ahead of 12 (so 14). Now we subtract the number of minutes (assuming that does not go over 12) and we have where it lands Hint: Remember that the modulus operator gives the remainder after division so 14 mod 12 be determined with 14 divided by 12 is 1 with a remainder of 2. Dont forget your parenthesis for your order of operations!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

See in this problem statement.. they didnt took actual minutes when they mention minutes. they took the numbers didplay on clock.. think it as this way..

you have numbers 1 to 12..

1 2 3 4 5 6 7 8 9 10 11 12

now take the input suppose its 5 2

if we go clock wise we end up at 7

assume that clock wise means in above list of numbers we have to go left to right.

or else you can just think it as this way... 5+2 = 7

if we go counter clock wise we end up at 3

assume that counter clock wise means in above list of numbers we have to go right to left.

or else you can just think it as this way... 5-2 = 3

let see example 2:

now if we get the input like 11 2

clock wise : 11+2 =13

see whenever our sum is over 12 . then you just have to do sum-12 . which is 13-12 = 1

so our out put will be 1

and in counter clock wise : 11-2 = 9

example 3:

lets take input 2 5

clock wise : 2+5 = 7

counter clock wise 2-5 = -3

see when our difference is less than 0 then you have to subratct it from 12(just take the number not sign)

12 - 3 = 9

sumup:

clock wise.. add the both inputs: and if the sum is greater than 12 then subtract 12 from it...( sum -12 )

counter clock wise.. subtract the both inputs .. and if the difference is less than 0 then subtract it from 12....( 12 - diff )

Add a comment
Know the answer?
Add Answer to:
This is for an entry level C++ course. Having trouble understanding what the question is really...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ssessment,id=215 Converts a physical variable into an electrical signa O converts an analog signal into o...

    ssessment,id=215 Converts a physical variable into an electrical signa O converts an analog signal into o digitol signal O Converts a digitol signol into an anolog signal QUESTION 4 The basic approach to testing D/A converters is to Ο App ya sequence of binary codes coveringthe full rangeofi put vakes to the creati put vhle ooserv ngt eat stonin o O Single-step the device through its full input range while checking the output with a DMM sepe The Check the...

  • I am having trouble figuring out what should go in the place of "number" to make...

    I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...

  • Hello, I am having some trouble with a supermarket checkout simulation program in C++. What I...

    Hello, I am having some trouble with a supermarket checkout simulation program in C++. What I have so far just basically adds customers to the queue and prints when they arrive. I am struggling with how to implement a way of keeping track of when a given customer finishes(I will attach what I have so far). I had already created queue and node classes (with headers and cpp files) that I modified in my attempt. I would be very grateful...

  • Having trouble with the do while/while loop and the switch statement. I got some of the...

    Having trouble with the do while/while loop and the switch statement. I got some of the switch statement but cant get the program to repeat itself like it should.What i have so far for my code is below. Any help is appreciated... i am not sure what I am doing wrong or what i am missing. I am completely lost on the while loop and where and how to use it in this scenario. import java.util.Scanner; public class sampleforchegg {...

  • PLEASE I NEED C# Objectives Learn the basics of exception handling. Background Exceptions are essentially unexpected...

    PLEASE I NEED C# Objectives Learn the basics of exception handling. Background Exceptions are essentially unexpected situations. It is difficult to write a program that can handle all possible situations, as we have found out through the many programs we have written. For example, should your program accept accidental input? Does it use the metric system or the empirical system? Do users of your program know which system it uses? In order to deal with all these possibilities, exceptions were...

  • Using C programming language Question 1 a) through m) Exercise #1: Write a C program that...

    Using C programming language Question 1 a) through m) Exercise #1: Write a C program that contains the following steps (make sure all variables are int). Read carefully each step as they are not only programming steps but also learning topics that explain how functions in C really work. a. Ask the user for a number between 10 and 99. Write an input validation loop to make sure it is within the prescribed range and ask again if not. b....

  • I have to write a program where the program prints a deck of cards. instead of having your regula...

    I have to write a program where the program prints a deck of cards. instead of having your regular suits and numbers the program will use a value for a number, id will be either rock, paper, or scissors, and the coin will be heads or tails. print example: 2 of rock heads. If the user is enters 1 the program will print out 30 of the print example and arrange them by there values. if the user enters 2...

  • C++ Programz

    Program 0 (50%): In many computer science courses, when you study sorting, you also study “runtime” - and it can be confusing to understand when you first see it.  For example, they say that BubbleSort “runs in O(n2)”  time (pronounced “Big-Oh of n-squared") - but what does that mean?  For simplicity, it means if you have n elements, the worst it could run would be n2 low-level computer operations (like comparisons, assignment statements and so on).  For example, if we...

  • Hello, I am having trouble with this C++ programming assignment. If someone could write the code...

    Hello, I am having trouble with this C++ programming assignment. If someone could write the code or at least part of it that would help me, because every code I try has errors. Using if Statements, Loops and Nested Loops • Scanning Characters in a String Using a Loop • Performing Character Arithmetic In project, you will write an interactive program that, counts the number of digits in a non-negative integer, factorizes the integer into powers of ten and its...

  • For programming C language This problem will be briefly discussed in Lab2 and the TĀ will...

    For programming C language This problem will be briefly discussed in Lab2 and the TĀ will give you hints to solve it. However, the TĀ will not write the code. This code is a bit complicated, so try to understand the process from the TA so that you can continue working on it at home. Reverse the Number Write a program that takes a 5-digit number as input and print the reverse of the number. Sample Input/Output: Enter a five...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT