C# console application - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C# console application

cowgirl1996cowgirl1996 United StatesPosts: 6Member

I'm extremely new to C# and having a very hard time with this one. Any and all help is greatly appreciated! The more detailed the help the better because I'm pretty lost on this one.

Write a C# console application for a furniture company. Ask the user to choose P for pine, O for oak, and M for mahogany. Show the price of a table manufactured with the chosen wood. Pine tables cost $100, oak tables cost $225, and mahogany tables cost $310. If the user enters something other than P, O or M, set the price to $0. Save your program as Furniture.cs.

Best Answer

Answers

  • cowgirl1996cowgirl1996 United StatesPosts: 6Member

    This is what I have so far:
    using namespace furniture;

    int main()
    {
    int a,b,c;
    double r;
    char ch,o,m,p;

    c=0;

    cout<< "Enter your spending limit."<<endl;
    cin>>b;
    cout<< "Please choose between Pine, Oak, Mahoganhi."<<endl;
    cin>>ch;

    switch(ch)
    {

    case 'p':

    a = 100;
    do
    {
    r=c+a;
    cout<<r<<endl;
    c=r;
    }
    while(r!=b);
    break;

    case 'o':
    a=225;

    do
    {
    r=c+a;
    cout<<r<<endl;
    c=r;
    }
    while(r!=b);
    break;

    case 'm':

    a=350;
    do
    {
    r=c+a;
    cout<<r<<endl;
    c=r;
    }
    while(r!=b);
    break;
    }

    return 0;
    }
    }
    }

  • cowgirl1996cowgirl1996 United StatesPosts: 6Member

    Yes something very similar, but all I need to do is have them pick a type of wood and display the price for that wood.

Sign In or Register to comment.