• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Please help with C# interview task

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a console program in C# to print out 5 verses of the song “Old MacDonald Had a Farm" with 5 animals of your choosing.The verse is repeated for each animal and the appropriate sound for the animal is used eg cows go “moo”, ducks go “quack” etc.?
Here is the song using cow:
Old MacDonald had a farm, E I E I O,
And on his farm he had a cow, E I E I O.
With a moo moo here and a moo moo there,
Here a moo, there a moo, ev'rywhere a moo moo.
Old MacDonald had a farm, E I E I O.

Please provide two solutions if you can, one using polymorphysm and one with data-driven approach!
 
Marshal
Posts: 67280
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No one here is going to do your work for you.
 
Sheriff
Posts: 13731
228
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Asking help for an interview? Wow. If I were the employer, this would be grounds for instant disqualification.
 
Rancher
Posts: 480
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need help with that, what are you going to do if you do get the job.
 
Al Hobbs
Rancher
Posts: 480
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you do polymorphism approach then the sounds would be hardcoded.  The data-driven would be like if you got the information from a file or database.
 
Saloon Keeper
Posts: 3462
149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the earlier replies, one might be forgiven thinking that the adage here is "there are no stupid answers, only stupid questions".
 
Bartender
Posts: 21004
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applicant rejected. Didn't bother to read basic instructions on how to create a Coderanch account name. Sloppy worker.
 
Junilu Lacar
Sheriff
Posts: 13731
228
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Piet Souris wrote:Looking at the earlier replies, one might be forgiven thinking that the adage here is "there are no stupid answers, only stupid questions".


It's blatant dishonestly that is not tolerated well around here.

OP wrote:Please provide two solutions if you can, one using polymorphysm and one with data-driven approach!


 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!