Please help me my teacher gave me this problems:
1. Create a program that will show the plural form of the input regular nouns.
example:
Input a regular noun: church
The plural form is: churches
Input a regular noun: tomato
The plural form is: tomatoes
2. Create a program when you input it a 4 number will say it as a year(Maximum year is 2009).
example:
Input a year:1922
The year is Nineteen Twenty Two
Input a year: 2003
The year is Two thousand three
3. Create a program that will determine the date of the inputed num and if it is a leap year or not.
example;
Enter a year: 2002
Enter the days: 365
It is December 31
Enter a year: 2004
Enter the days: 365
It is December 30
Please help me the deadline is at the 2nd week of March and we can only use arrays,loops and if statements.
What do you have so far?
as for now I am at the 1/4 of the second problem; I think it is the only problem I can solve.. please will you help me? post the code or sent it to me please I am begging you.
You could set each character inputted individually, then use if statements to display the words.
As for the last one, I'm stuck as well.
1922 % 100 == 19 --> "Nineteen"
1922 / 100 == 22 --> "twenty two"
Break your problem into parts.
1922 % 100 == 22 --> "twenty two"
1922 / 100 == 19 --> "Ninteen"
Break your problem into parts.
I'm actually curious as to how to do the second problem. If your trying to cover all possible dates, 0001-> end of days, is there a "finesse" way?
You have to high a high-end number, just so you're not teaching it how to say everything up to a googleplex. But I'd think the "finesse" way would be to break the number into recognizable units. For a general number you'd break it into 3-digit units, just like where you put the commas. For dates, I think going up to just 4 total digits and two 2-digit sections should be sufficient. The first two digits (the ones and tens place) you have to program the numbers from 01 to 19 individually because they don't follow a set pattern, but it gets more elegant (i.e., there's a pattern) once you hit the 20s. The same script could be copied/pasted and tweaked slightly to get the last two digits (the hundreds and thousands place).
For determining is-year-leap I would use DateTime class. It has a method for that, System.DateTime.IsLeapYear(int). If you want to implement the code determining it yourself, then look for a Wikipedia article describing what cryteria there are.
For spelling years I would really suggest using Winged' code with modulo and division (% and /). Then I would use switch statements for numbers but if you cannot use switch then make if counterparts.
For grammar code I would first look for some Wikipedia article which states what rules there are for making plural forms. I think it's just a matter of String.EndsWith("o") and few similar checks for ending letters.
If you want more detailed help, you have to show us some concrete code.![]()
proudly presenting my personal website and game website: F1Simulation. a thrilling Managed DirectX racing game... also my Ask Me
look at my tutorials about cropping images and Mono: bundling Mono with programs and lambda expressions
got any half-done codes?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks