Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming Questions 2 . ( 6 points ) The U . S . Census Bureau projects population based on the following assumptions: a . One
Programming Questions
points The US Census Bureau projects population based on the
following assumptions:
a One birth every seconds
b One death every seconds
c One new immigrant every seconds
Write a program to display the population for each of the next five years. Assume that the current population is and one year has days.
Here is a sample run:
year :
year :
year :
year :
year :
points Write a program that prompts the user to enter the seconds eg billion and displays the number of years, days, hours, minutes, and seconds. For simplicity, assume a year has days.
Here is a sample run:
Enter number of seconds eg billion
In there are: years
In there are: days
In there are: hours
In there are: minutes
In there are: seconds
points Write a program that generates a lottery of a threedigit number. The program prompts the user to enter a threedigit number and determines whether the user wins according to the following rules:
a If the user input matches the lottery number in the exact order, the award is $
b If all digits in the user input match all digits in the lottery number, the award is $
c If one digit in the user input matches a digit in the lottery number, the award is $
Here are sample runs:
Enter your lottery pick three digits:
Lottery is
Sorry, no match
Enter your lottery pick three digits:
Lottery is
Match one digit: you win $
Enter your lottery pick three digits:
Lottery is
Match all digits: you win $
Enter your lottery pick three digits:
Lottery is
Exact match: you win $
points Write a program that prompts the user to enter the center coordinates and radii of two circles and determines whether the second circle is inside the first or overlaps with the first, as shown in the below figure.
Hint:
circle is inside circle if the distance between the two centers r r
circle overlaps circle if the distance between the two centers r r
Test your program to cover all cases.
Here are sample runs:
Enter circles center x ycoordinates, and radius:
Enter circles center x ycoordinates, and radius:
circle is inside circle
Enter circles center x ycoordinates, and radius:
Enter circles center x ycoordinates, and radius:
circle overlaps circle
Enter circles center x ycoordinates, and radius:
Enter circles center x ycoordinates, and radius:
circle does not overlap circle
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started