Write a program that uses repetition and switch statements to print the song "The Twelve Days of Christmas." One switch statement should be used to print the day (i.e., "first," "second," etc.).A separate switch statement should be used to print the remainder of each verse.
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Write a program that uses repetition and switch statements to print the song "The Twelve Days...
import java.util.Scanner;
public class TwelveDays
{
public static void main(String[] args)
{
final int MAX = 12;
int lastDay = 0; //last day for the
song, user will update
Scanner scan = new
Scanner(System.in);
//Get the last day and use input
validation
//Begin 1st while
{
}
int day =
1; //loop control variable for song
verses
//Begin 2nd while
{
//Output: "On the"
+ day...
Write a program that will prompt the number of shipping days as well as the day of the week an item that has been ordered may arrive. - use a switch statement to assign the day of the week as well as the number of the day (Sun = 0, mon = 1, etc.) - use another switch statement and modulus operator for finding a day of the week in the future
Write a program that uses String method regionMatches to compare two strings input by the user. The program should prompt the user to enter two strings, the starting index in the first string, the starting index in the second string, and the number of characters to be compared. The program should print whether or not the strings are equal, (Ignore the case of the characters during comparison.) 四SAMPLE RUN #1: java StringCompare Highlight: None D Show Highlighted Only Interactive Session...
Write in Java program that writes three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print: 800 775 790
How would I use switch statements to write a program that will take an input of length (such as 23.4) and its unit by choosing from a menu. The menu should users which unit they want to convert by choosing off of a menu. The program then should output the converted length. The units the program supports are in, ft, yd, mi, m, km. Also have the program print out an error if either the input units or the conversion...
a) Write a program that uses a while loop to print all divisors of a number supplied by the user. The program should also print the sum of all the divisors and whether the number the user entered is a prime number or not. Note: The definition of a divisor is a number that divides another evenly (i.e., without a remainder) and the definition of a prime number is a number whose only divisors are 1 and itself. b) Implement...
FOR RUBY:
-----------------------------------
Create a program named Gifts. This program will describe the
gifts for the 12 Days of Christmas.
Each day describes one gift only. You cannot explicitly output
the list of gifts, you need to get each day to display. For
instance, for the 3rd day of Christmas, you display the gift for
the 3rd day, then display the gift for the 2nd day, then the gift
for the 1st day.
Think about the logic for this.. in...
C++ Write a program that illustrates enumeration types. Define an enumeration type for the months of the year. This should be global. Put it above the main program. Declare a variable of the enumerated type called month; Declare an array of unsigned integers called year[12] and initialize the array to the days in each month. (Just assume 28 for February.) 1. Write a loop that will progress from January through December printing out the days in each month. The index...
please complete this program. and make sure it works.
code only written in c++
Thi s project will introduce switch-statements and logical operators Write a program that uses a switch-statement and loops to decide how to assign airline passengers to a particular class of seating on a plane. Prompt for passengers to add, and then (for each passenger) prompt for both class, and destination. As each passenger is entered, print out what flight, and what class they are in. At...
Write a program that calculates the amount a person would earn over a 30-day period of time if his/her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. A sample output might look...