Home Answers Viewqa Java-Beginners i need to answer this Question but i can't do it probably

 
 


mahamat ali
i need to answer this Question but i can't do it probably
2 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners

use the web to locate the lyrics to the traditional song"The Twelve Days of Christmas" the song contains a list of gifts received for the holiday.the list is cumulative so that as each "day" passes, a new verse contains all the words of the previous verse, plus a new item. write an application that displays the words to the song starting with any day the user enters.(Hint: Use a switch statement with cases in descending day order and without any break statements so that the lyrics for any day repeat all the lyrics for previous days.) save the file as TwelveDays.java

View Answers

February 17, 2011 at 4:07 PM


Java Twelve day of Christmas

public class TwelveDays
{
    public static void main(String[] args)
    {
        System.out.print("Twelve Days of Christmas\n\n");
        int index;

        String ordinal_numbers[] = { "first", "second",   "third",  "fourth", "fifth",  "sixth",  "seventh",  "eighth",  "ninth", "tenth", "eleventh",  "twelfth"};

        for(index = 1; index <= 12; ++index)
        {
            System.out.print("On the " + ordinal_numbers[index-1]+ " day of Christmas,\n");
            switch(index)
            {
                case 12:
                    System.out.println("Twelve Drummers Drumming");

                case 11:
                    System.out.println("Eleven Pipers Piping");

                case 10:
                    System.out.println("Ten Lords a Leaping");

                case 9:
                    System.out.println("Nine Ladies Dancing");

                case 8:
                    System.out.println("Eight Maids a Milking");

                case 7:
                    System.out.println("Seven Swans a Swimming");

                case 6:
                    System.out.println("Six Geese a Laying");

                case 5:
                    System.out.println("Five Golden Rings");

                case 4:
                    System.out.println("Four Calling Birds");

                case 3:
                    System.out.println("Three French Hens");

                case 2:
                    System.out.println("Two Turtle Doves");

                case 1:
                    if(index == 0)
                        System.out.print("A Partridge in a Pear Tree.\n\n");
                    else
                        System.out.print("and a Partridge in a Pear Tree.\n\n");
                    break;
                default:
                    System.out.print("Internal Error.");
                    System.exit(1);
            }
        }                                     
    }
}

February 17, 2011 at 9:48 PM


thanx very much









Related Pages:
i need to answer this Question but i can't do it probably
i need to answer this Question but i can't do it probably   use the web to locate the lyrics to the traditional song"The Twelve Days of Christmas" the song contains a list of gifts received for the holiday.the list is cumulative
Add color to background but I can't labels or textfields
Add color to background but I can't labels or textfields  Please help...); f.setVisible(true); } }");   For label you need to create and initialize the JLabel class object and add it to container. Inorder to do that you
i cNT GET ANSWER FOR THIS QUESTION
i cNT GET ANSWER FOR THIS QUESTION  The roots of the quadratic equation ax2+bx+c=0, aïâ??¹0 are given by the following formula: x=(-bÃ?±âË?Å¡(b^2-4ac))/2a In this formula. The term b2-4ac is called
share your answer to this question
share your answer to this question  i need to know what is the TELERIK CONTROL? what is the map suite? what is dunda chart? Also i have to know what... to search for the above mentioned topics and where i can get relevant information
how do i solve this question?
how do i solve this question?  1.Define a class named Circle with the following properties: a) An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier
How do I track how many hits my website gets
There are some terminologies that need to be cleared before knowing the answer of this question. Hits- this simply refers to the number of 'elements' loaded on your site. If one page has five images in it, viewing that page
what is java and why do i need it?
what is java and why do i need it?  Hi, Please tell me what is Java and why do i need it? Is it free to download? Also explain me how to write and test my first Java Application? What is the configuration or system requirement
question
question  which package do i need to import to use length() method for strings. the compiler shows an error telling me that it can't find length() method
PureStack question---i dont know how to do this
PureStack question---i dont know how to do this  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from... the queue g. H and I join the queue h. G leaves the queue i. H and I leave
PureStack question---i dont know how to do this
PureStack question---i dont know how to do this  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from... the queue g. H and I join the queue h. G leaves the queue i. H and I leave
hello there i need help
hello there i need help  : i need to do a program like... me with the codes and please explain to me how it works. i only need to use... OPtions: once i have chosen an option then i should proceed here if i choose b
This is what i need in this Question - Java Beginners
This is what i need in this Question  You are to choose between two... array. so i need your help to know is it correct or wrong Thank you... explaination with out coding In my understanding I choose the non-empty array
Clarify my last question's answer - Java Beginners
many times your solution but I'm not sure why it is not working. And I do not see how your solution is giving me the matching that I hope to do. Netbean Ide... purpose is when I do a search, I'll be able to display the tutors particulars like
to know my answer
to know my answer  hi, this is pinki, i can't solve my question "how to change rupee to dollar,pound and viceversa using wrapper class in java." will u help me
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me..  Write a program... reversedNumber = 0; for (int i = 0; i <= num; i...; reversedNumber = reversedNumber * 10 + r; i = 0
This is what i need - Java Beginners
. for this question i need just : one function can read string like (I like...This is what i need  Implement a standalone procedure to read in a file containing words and white space and produce a compressed version of the file
i need help - Development process
i need help  hello, i need help regarding this program. public... the result in to the files,if i want to do this i must make my program running...()); } } } it is printing the result of ping in to a file,but if i want
i need help - Development process
i need help  hello, i need help regarding this program. this program... IPAddress on command line, but i want to take it dynamically and it must store the result of ping in to a file . can anyone guide me how to do it please
i want to do a project using jsp and servlet....What are all the materials i need to study
i want to do a project using jsp and servlet....What are all the materials i need to study   i want to do a project using jsp and servlet....What are all the materials i need to study ?   Please visit the following
How do I compile the registration form?
How do I compile the registration form?  How do I compile the registration form as stated at the bottom of the following page (URL is below). Do I need ANT? If so, please give instructions. I am a student. http
i/o
i/o   Write a Java program to do the following: a. Write into file the following information regarding the marks for 10 students in a test i. Matric no ii. Marks for question 1 iii. Marks for question 2 iv. Marks
XML Interviews Question page19
namespaces? I don't know the answer to this question, but the likely reason...;   How do I use prefixes to refer to element type and attribute... and that it is still in scope . All you need to do then is prefix the local name
question
question  suppose i had downloaded the zip file,extracted it in local directory so how automatically will it integrate with eclipse? i mean do i need to set some path or something
send answer
send answer  For online exam project,i want single question on single page and on that page there are three buttons previous,submit,next.If i click on next button it show next question from database
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
how do i begin a two dimensional array?
how do i begin a two dimensional array?  I'm new to java programming and need to create a two dimensional array that enters exactly what is entered in the first dimension and then the first non-white space character of what
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO...*; import java.lang.*; public class LinkedListv4 { char question; Scanner console.... Print the list"); System.out.println("| i. Print the list from
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO...*; import java.lang.*; public class LinkedListv4 { char question; Scanner console.... Print the list"); System.out.println("| i. Print the list from
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO...*; import java.lang.*; public class LinkedListv4 { char question; Scanner console.... Print the list"); System.out.println("| i. Print the list from
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO...*; import java.lang.*; public class LinkedListv4 { char question; Scanner console.... Print the list"); System.out.println("| i. Print the list from
question
question  following is my code to sent mail but i couldn't work with eclipse ,that have some errors .need i any set up in eclipse or tell to what can i do to work code properly. <%@ page import="java.io." import="java.lang.
Dear Sir I need to join u
Dear Sir I need to join u  Dear Sir i am santosh Rai from Saudi Arabia please make me understood how to join u and i have one question i want to working with you what is ur process for working with u please send me
Netbeans Question need help desperately!!
Netbeans Question need help desperately!!   Ok here is my code- public class RollDie2 { public static void main(String[] args) { Random... dice. How do I get the frequency of the numbers to print
Please answer me - JSP-Servlet
Please answer me  Hello Guys, this is the third time I'm sending this question. But I've not got the right answer from you. The again is: I need java servlet or jsp codes that I can use to insert and retrieve image from MSSQL
i need some help in understanding the following codes.thanks..
i need some help in understanding the following codes.thanks..  this code is to perform LocalColorHistogram.But i can't understand it public... * height; int i = 0; int j = 0; int k = 0; double
How to find the exact PHP template I need?
How to find the exact PHP template I need?  Hi! I'm a PHP Pro?I think I am one?, but this is the first time for me to try a PHP template, so I have no clue on how to choose one. Do you have some tips to help me choose
need help pleaseee....i weak in java
need help pleaseee....i weak in java  QUESTION 1 You are required to write an application called Customer Billing System. This system...) Separate them as either R/r for Residential or I/i for Industrial. You can use
i need project
i need project  can u send online shoppin project 2 my mailid.   Please visit the following links: Struts2 Shopping cart JSP-Servlet Shopping cart
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating... and their methods as needed. What program should do (Tasks): i) Read data in from..., and the student's GPA.using arrays and objects, need to structure the information
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??) and is defined as follows: n!=n...=input.nextInt(); long num=m; for(int i=m;i>1;i
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., I want a second class that is able to tell the owner how much he made that day
please i want someone to answer me pleeeeeeeeeeeeease...
please i want someone to answer me pleeeeeeeeeeeeease...    Write a JAVA program using 2D array to auto-grade exams. For a class of N students, your... answer key as Final Array in your program.( using 2D array
How can I do it? .click();
How can I do it? .click();  I have a very unusual problem. I want...("a"); x.click(); </script> So it's click on an element witch one Id's is "a", but I want that it make mouseup in this element. How can I do it, because if I write
I/O Program output error
the total. I also need the pValues to be in decimal format like(#.##), but I can't... of the program in that it reads the text file and analyzes it, however I need it to take... is pValue), however the output just shows each Agent ID and then each pValue. I do
help i want it now the answer pleas...
help i want it now the answer pleas...  write a program that will display the exactly output as below: Hints: declare and initialize value of array in double type.Read and write all elements of array.perform the multiply
Java experts.Please answer this question - Java Beginners
Java experts.Please answer this question  class A { void get...("Success"); }} I want to know that is it true that 'a' refers to objects of all...,then, logically speaking, shouldn't a.set() be allowed as d.set() although i understand
how do i solve this problem?
how do i solve this problem?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access
I need to display parts of my own website on another website in an iframe
I need to display parts of my own website on another website in an iframe  I need to display parts of my own website on another website in an iframe. please refer me how do i do
I am new to programming and I am not sure what to do next? Any ideas?
I am new to programming and I am not sure what to do next? Any ideas? ...()==0) return false; for(int i=0;i<=str.length();i++) if (c==str.charAt(i)); return true; } // If userInputs

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.