TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
stephen turvey
NA
17
11.4k
if statments
Oct 8 2010 4:58 AM
Hi everyone help please. I'm a noob to c# sharp but I'm getting there. I've been working on a project for class but I can't get it to work. When it runs I get a blanks screen. Here is the code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assignment_3
{
class Program
{
static void Main(string[] args)
{
char y = (char)Console.Read();
double DblA; // none members
double DblB; // none members
double DblC; // none members
double DblD; // none members
double Dbl2PersonTent = 3.00; // none members
double DblOtherTents = 5.00; // none members
double DblCaravan = 10.00; // none members
double DblChalet = 15.00; // none members
double DblMA; // Start Members
double DblMB;
double DblMC;
double DblMD;
double Dbl2PersonTentMembers = 2.25;
double DblOtherTentsMembers = 3.75;
double DblCaravanMemebers = 7.50;
double DblChaletMembers = 11.25; // End Members
double DblNightsStay;
String StrNightsStay;
char a = (char)Console.Read();
char A = (char)Console.Read();
char b = (char)Console.Read();
char B = (char)Console.Read();
char c = (char)Console.Read();
char C = (char)Console.Read();
char d = (char)Console.Read();
char D = (char)Console.Read();
DblA = Dbl2PersonTent;
DblB = DblOtherTents;
DblC = DblCaravan;
DblD = DblChalet;
StrNightsStay = Console.ReadLine();
DblNightsStay = double.Parse(StrNightsStay);
Console.WriteLine("Are you a member enter Y for yes or N for no: ");
if (char.IsLetter(y))
{
Console.Write("\nA 2 Person tent £3.00 per night");
Console.Write("\nB Other tents £5.00 per night");
Console.Write("\nC Caravan £10.00 per night");
Console.Write("\nD Chalet £15.00 per night");
Console.Write("\nMembers get a 25% Discount");
Console.ReadLine();
Console.Write("Please enter A,B,C,D for your chosen holiday type: ");
if
(Char.IsLetter(A))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblMA = Dbl2PersonTentMembers * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblMA);
Console.ReadLine();
}
else if
(Char.IsLetter(B))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblMB = DblOtherTentsMembers * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblMB);
Console.ReadLine();
}
else if
(Char.IsLetter(C))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblMC = DblCaravanMemebers * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblMC);
Console.ReadLine();
}
else if
(Char.IsLetter(D))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblMD = DblChaletMembers * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblMD);
Console.ReadLine();
}
}
else
{
Console.Write("\nA 2 Person tent £3.00 per night");
Console.Write("\nB Other tents £5.00 per night");
Console.Write("\nC Caravan £10.00 per night");
Console.Write("\nD Chalet £15.00 per night");
Console.ReadLine();
Console.Write("Please enter A,B,C,D for your chosen holiday type: ");
if
(Char.IsLetter(A))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblA = Dbl2PersonTent * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblA);
Console.ReadLine();
}
else if
(Char.IsLetter(B))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblB = DblOtherTents * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblB);
Console.ReadLine();
}
else if
(Char.IsLetter(C))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblC = DblCaravan * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblC);
Console.ReadLine();
}
else if
(Char.IsLetter(D))
{
Console.Write("how many nights would you like to stay: ");
StrNightsStay = Console.ReadLine();
DblD = DblChalet * DblNightsStay;
Console.WriteLine("Your Cost for this holiday is £");
Console.WriteLine(DblD);
Console.ReadLine();
}
}
}
}
}
Reply
Answers (
13
)
ScrollBar Problem in Tabcontrol
how to take one form values into another form in windows applications?