Are These Integers Equal?
Ask the user for two integers. Check and see if the two integers are equal to each other. If they are, inform the the user that the numbers are equal, else inform the user that the numbers are not equal
Input: 16
Input: 18
Output: The numbers 16 and 18 are not equal to each other
Input:Enter your first number: 25
Input: Enter your second number: 25
Output: The numbers 25 and 25 are the same number
Even or Odd?
Ask the user for a number. Tell the user if that number is even or odd.
Input: 15
Output: 15 is an odd number
Input: 116
Output: 116 is an even number
Vowel or Consonant?
Ask the user for a letter. Check whether a letter is a vowel or consonant. Hint: You can do this problem using a switch or an if condition.
Input: a
Output: That letter a is a vowel
Input: c
Output: The letter c is a consonant
Find the Largest Number
Prompt the user to input two integer values. Find and print the greatest value of the two integers.
Input: 25
Input: -25
Output: 25 is the larger number
- BONUS: Ask the user for 3 numbers and find the greatest value between those 3 numbers
Divisible by 3
Ask the user for a number and then tell them if it is divisible by 3
Input: 5
Output: not divisible by 3
Input: 306
Output: divisible by 3
Restaurant Bill
At a restaurant, Mike and his three friends decided to divide the bill evenly. If each person paid $13 then what was the total bill? Use arithmetic operators and print the amount of the total bill to the console.
- Returning to the above problem, replace hard-coded values of 4 (number of diners) and 13 (cost per diner) with values provided by the user.
- How nice! The restaurant is having Customer Appreciation Week. If a table’s total bill is $50 or more, then they’ll receive a 10% discount! Otherwise, they’ll receive a 5% discount.
For example:
Input: 6
Input: 17
Output: You earned a 10% discount. Your total bill is $91.80.
For example:
Input: 4
Input: 10
Output: Your total bill is $40.00. You will receive $2.00 off your total bill for Customer Appreciation Week.
Age Category
You're responsible for providing a demographic report for your local school district based on age. To do this, you're going to determine which 'category' each person fits into based on their age. The person's age will determine which category they should be in:
- If they're from 0 to 2 the child should be with parents print : 'Still in Mama's Arms'
- If they're 3 or 4 and should be in preschool print : 'Preschool Maniac'
- If they're from 5 to 11 and should be in elementary school print : 'Elementary School'
- From 12 to 14: 'Middle School'
- From 15 to 18: 'High School'
- From 19 to 22: 'College'
- From 23 to 65: 'Working for the Man'
- From 66 to 100: 'The Golden Years'
- If the age of the person is less than 0 or more than 100 - it might be an alien - print: "This program is for humans".
Input: 13
Output: You are in Middle School
Words to Digits
Having a string representation of a number, you need to print the digit form of the number. Ask the user to enter a string representation of a number from zero to ten. Using switch case, print the digit (0-10) representation of the number.
Input: two
Output: 2
Which Name is Longer?
Ask the user for their first and last name.
- Print the user's full name.
- If the first name is longer than the last name, print "First is longer."
- If the first name and last name are the same length, print "Same-sies!"
- Otherwise, print "Last must be longer!"
Input: Mary
Input: Brown
Output: Mary Brown. Last must be longer!
Are these Names the Same?
Ask the user for 2 names.
- If the two names are the same, print "The names are the same."
- If they're not the same, print "The names are different."
Input: Joe
Input: Joseph
Output: The names are different
First try using == and then try it using .Equals()
Name and Place of Birth
Ask the user for their first name and where they were born. Print a sentence to the console that repeats this information.
Input: John
Input: Delaware
Output: Hi John! You were born in Delaware.
Input: Yvonne
Input: San Diego
Output: Hi Yvonne! You were born in San Diego.