![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
Re: need someone to write me a programme
$99.98 and I'll even send you a picture of someone's mother.
__________________
People who click "images" that end with .exe shouldn't have computers. |
|
|
|
|
|
#22 |
|
Newbie
Join Date: Apr 2004
Posts: 25
Rep Power: 0
![]() |
Because this was a good task to take on for a person very new to programming, I decided to give it a go. Critisism is always welcome
![]() //Copyright (c) 2008, Kriss <mikemikeoscarAyahoo.com>
//
//Permission to use, copy, modify, and/or distribute this software for any
//purpose with or without fee is hereby granted, provided that the above
//copyright notice and this permission notice appear in all copies.
//
//THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
//WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
//MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
//ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
//WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
//ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
//OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
using System;
namespace Leisureclub
{
class MainClass
{
public static void Main(string[] args)
{
int IsMember = 0;
double CheckAge;
double GetPrice;
Functions f = new Functions();
while (IsMember != 3)
{
IsMember = f.CheckValidMember();
if ( IsMember != 3)
{
CheckAge = f.CheckAge();
switch (IsMember)
{
case 1:
GetPrice = f.CalculatePriceMember(CheckAge);
Console.WriteLine("The price is EUR{0}", GetPrice);
break;
case 2:
GetPrice = f.CalculatePriceNonMember(CheckAge);
Console.WriteLine("The price is EUR{0}", GetPrice);
break;
case 3:
System.Environment.Exit(0);
break;
default:
Console.WriteLine("Error of some sorts, exiting");
break;
}
}
}
}
}
class Functions
{
public int CheckValidMember()
{
int IsMember;
Console.WriteLine("\n1. Member\n2. Not Member\n3. Exit\n");
Console.Write("Enter choice: ");
IsMember = Convert.ToInt32(Console.ReadLine());
if (IsMember == 1)
return 1;
else if (IsMember == 2)
return 2;
else if (IsMember == 3)
return 3;
else
return 4;
} //
public double CheckAge()
{
double CheckAge;
Console.Write("Please enter your age: ");
CheckAge = Convert.ToInt32(Console.ReadLine());
return CheckAge;
}
public double CalculatePriceMember(double Age)
{
double price;
if ( Age >= 31 )
price = 3.5;
else if ( Age <= 30 )
price = 7.5;
else if ( Age >= 18 )
price = 7.5;
else
price = 0;
return price;
}
public double CalculatePriceNonMember(double Age)
{
double price;
if ( Age >= 31 )
price = 5.5;
else if ( Age <= 30 )
price = 10;
else if ( Age >= 18 )
price = 10;
else
price = 0;
return price;
}
}
}ps. the license is more of a joke aimed towards the original poster ![]()
__________________
Rock on! |
|
|
|
|
|
#23 |
|
Expert Programmer
|
Re: need someone to write me a programme
Critisism:
You didnt charge them to do it. You did it for them and it was homework, therefore they didn't learn anything. Yup, that's all the critisism i have for you. ![]()
__________________
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ashars antivirus programme in c errors help | dragosam | C | 8 | Nov 18th, 2007 5:46 AM |
| if it exists use it? or write it? | rwm | C++ | 8 | Aug 21st, 2007 3:00 AM |
| How much can a C++ programme extract from a .txt file? | Ade | C++ | 14 | May 4th, 2006 6:46 AM |
| First Python Programme: Fibonacci Finder | UnKnown X | Python | 2 | Dec 15th, 2005 6:19 PM |
| Trying to write jsp files to MySql Database | reubenfields | Java | 1 | Apr 14th, 2005 9:51 AM |