Javafx
Given the poem:
Thirty days hath September
April, June, and November
All the rest have thirty-one
with February's 28 to make it fun.
Leap Year happening one in four, Gives February one day more.
Write a program that does the following:
1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a valid month. Note: You may want to use an Enum.
2. Prompts the user for a year (e.g. 2016).
3. For months with 31 days, output the phrase "all the rest have thirty-one". For September, the phrase "Thirty days hath September". For April, June, and November the phrase "April, June, and November". For February, if the year is not a leap year, output the phrase "with February's 28 to make it fun.". If the use did supply a leap year (and the user supplied February as the month), output the phrase "Leap Year happening one in four, Gives February one day more."
4/ Use a scroll bar for the month and a TextField for the year that must be filled in if the month is February. Use a read only TextField for the line of the poem that you output.
//program to implement month and year with proper comments as output.
#include<bits/stdc++.h>
using namespace std;
int main(){
map<string,int> m;
int year;
string month;
m["January"] = 1;
m["February"] = 2;
m["March"] = 3;
m["April"] = 4;
m["May"] = 5;
m["June"] = 6;
m["July"] = 7;
m["August"] = 8;
m["September"] = 9;
m["October"] = 10;
m["November"] = 11;
m["December"] = 12;
cout<<"Please enter a month from January,
February, March, April, May, June, July, August, September,
October, November, December : ";
cin>>month;
if(m[month] == 2){
cout<<"Enter year : ";
cin>>year;
if(year%4==0){
cout<<"Leap Year happening one in four, Gives February one
day more."<<endl;
return 0;
}
cout<<"with February's 28 to
make it fun."<<endl;
return 0;
}
else if(m[month] == 1 || m[month] == 3 || m[month] ==
5 || m[month] == 7 || m[month] == 8 || m[month] == 10 || m[month]
== 12 ){
cout<<"all the rest have
thirty-one"<<endl;
return 0;
}
else if(m[month] == 9){
cout<<"Thirty days hath
September"<<endl;
return 0;
}
else if(m[month] == 4 || m[month] == 6 || m[month] ==
11){
cout<<"April, June, and
November"<<endl;
return 0;
}
cout<<"Error : Invalid month, Please enter a
valid one!"<<endl;
return 0;
}
Javafx Given the poem: Thirty days hath September April, June, and November All the rest have...
Given the poem: Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more. How would I write this program using an Enum instead of an array? 1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a...
Days Given the poem: Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more. Write a program that does the following: 1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a valid month. Note: You may...
Python Error: Writing a program to complete the following: Prompt the user for the name of an input file. Open that file for input. (reading) Read the file using a "for line in a file" loop For each line, o print the line and compute and print the average word length for that line. Close the input file Sample output: MY CODE IS WRONG AND NEED HELP CORRECTING IT!!! ------------------------------------------------------------------------------------------------------------------------ DESIRED OUTPUT: Enter input file name: Seasons.txt Thirty days hath September...
Cash Discount Review, Tu 41400 Chapter 8 and Distribution Finance Handy Rule: "30 days hath September. April June and November all the others have 31 expect February which has 28 and sometimes 29" (author unknown) 1. Calculate the cash discount offered and the amount paid as stated in the problems below: Item Invoice Amount Invoice Date Discount terms Date Pald Amount Pald a $1,790 1/10, n/30 3/1 3/10 $1,772.10 b. $7,194 2/10, n/30 3/28 4/17 $7,050 2. A distributor is...
Lab/HW 3 Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer representing a month b) an integer representing the day of the month c) an integer representing a year 1. Check that the month is between 1 and 12. If it’s not print an error message. 2. Day cannot be 0 or less nor can it be more than 31 for all months. Print...
JAVA CODE Beginner. please use if, else if or switch statements, but don't use arrays, please Write a program that reads a string from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format mm/dd/yyyy. A valid month value mm must be from 1 to 12...
PYTHON Build a regular expressions based on informal specifications to match specified patterns. Use a compiled regular expression in a Python program where appropriate. Use Python's text processing str methods to generate a string format converter. create a date format converter. Your program will convert a date in the format “mm/dd/yyyy” to the format “month day, year”. Specify the required input format: mm/dd/yyyy Use a regular expression to validate the user input date format. If the format is incorrect raise...
Occupancy-Days 3,400 280 Nm 0 0 Month January February March April May June July August September October November December Electrical Costs $ 10,234 $10,052 $11,605 $ 6,825 $ 2,380 $ 6,860 $ 11,060 $11,100 $ 7,602 $ 3,605 $ 4,634 $ 8,974 4,040 4,080 2,240 1,030 1,460 2,700 Required: 1. Using the high-low method, estimate the fixed cost of electricity per month and the variable cost of electricity per occupancy-day. (Do not round your intermediate calculations. Round your Variable cost...
Question 1: Write a program in C that reads a date from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format: mm/dd/yyyy Note that there is no space in the above format. A date in this format must be entered in one line. A valid...
C Program Question 1: Write a program that reads a date from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format: mm/dd/yyyy Note that there is no space in the above format. A date in this format must be entered in one line. A valid...