Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Write a program that reads a whole number of up to nine digits and prints it in words. For example, the input 13247 ought to produce "thirteen thousand two hundred forty seven". i need a step-by-step explanation not the code and i am supposed use the switch statement

Computer Science
See more answers at
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly


Get your free account and access expert answers to this and thousands of other questions

which programming language?
The first thing to look at is the limits. You need 9 digits. This means that your words need to go up to 999,999,999 or [Nine Hundred and Ninety Nine] Million, [Nine Hundred and Ninety Nine] Thousand, [Nine Hundred and Ninety Nine]. And in the repeated section, there's more repetition... [Nine] Hundred and Ninety [Nine] Hopefully you see that you'll only need to store the words of the following types "one", "two", "three", ... "eleven", "twelve", "thirteen", ... [special case] "twenty", "thirty", "forty", ... "hundred", "thousand", "million", ... Once you have them stored, you just need to print them in the right order. This is where the switch comes in. For example: switch(number){ case 1: //print "one" break; } You may need multiple switches, depending on how you structure it.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

What does a switch do?
lol is this class about AI??
A switch is used in place of lots of ifs and elses, in practice. Instead of: if (number == 1){ //do something } else if (number==2){ //do something } You do this: switch(number){ case 1: //if number is 1, execute this code break; case 2: //if number is 2, execute this code break; } You'll potentially want to use both in different circumstances. A switch is definitely easier for multiple situations, especially if you want to execute the code for two options in only some of the cases (if you don't include break at the end of a case, it will run through until the end of the switch or the next break statement).
@bdean20, thanks for the explanation. I don't fully understand it, because I know nearly nothing about computer science and programming languages. I've been trying to find sources online to learn about these topics: Open Study, Udacity, YouTube, Khan Academy; but, so far I've had a lot of trouble understanding because I am wholly unfamiliar.
@bdean20 on youtube look up thenewboston and he has some preety good tutorial for c++, python, Java, and some others. I know that for Java it has helped me out a lot, and we use it for my class.

Not the answer you are looking for?

Search for more explanations.

Ask your own question