Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:58:34+00:00 2026-06-12T15:58:34+00:00

I am having trouble with layout, I know I am close. /// I have

  • 0

I am having trouble with layout, I know I am close. /// I have two errors that are (31,18): error CS1002: ; expected & (31,13): error CS1525: Invalid expression term 'else' /// I have tried to do what was said and it made more errors, so I am totally don’t know how to make this work now.

At the moment I have this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CE0721a
{
    class Tut4_7
    {
        public void run()
          {
            double under16_Free = 2.5;
            double oap = 3.0;
            double other = 5.0;
            int groupSize = 0;
            double totalCost = 0;
            int age = 0;

        while (age!=-1)
        {
            Console.WriteLine("Enter an Age or -1 to quit");
            age=int.Parse(Console.ReadLine());

            if(age<16)&(age>-1);
            {
                groupSize++;
                totalCost = totalCost + under16_Free;
            }
            else if(age>16)
            {
                groupSize++;
                totalCost = totalCost + oap;
            }
            else if(age>16)&(age<=65);
            {
                groupSize++;
                totalCost = totalCost + other;
            }
        }
        if (groupSize>6)
        {
            totalCost = totalCost - (totalCost/5);
        }
        Console.WriteLine("Total Cost = "(totalCost));
        }
    }
}

I am trying to do this

**Write a program, for the local swimming pool that displays the admission cost for a group of people based on their age. The program should continue to prompt the user to enter an age until –1 is entered, and then display the total number of people in the group and the total cost for that group. Admission fees are as follows:
– under 16’s £2.50 over 65 -£3 and all other swimmers – £5

A 20% discount should be applied to groups of more than 6 people.**

This is connected to another cs called Program.cs, laid out like this and works, because I have tested with other cs files, this displays the program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CE0721a
{
    class Program
    {
        static void Main(string[] args)
        {
            Tut4_7 myProgram = new Tut4_7();
            myProgram.run();
        }
    }
}

Thanks again, if anyone can help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:58:35+00:00Added an answer on June 12, 2026 at 3:58 pm

    Try this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace CE0721a
    {
        class Tut4_7
        {
            public void run() 
              { 
                double under16_Free = 2.5; 
                double oap = 3.0; 
                double other = 5.0; 
                int groupSize = 0; 
                double totalCost = 0; 
                int age = 0; 
    
            while (age!=-1) 
            { 
                Console.WriteLine("Enter an Age or -1 to quit"); 
                age=int.Parse(Console.ReadLine()); 
    
                if((age<16)&&(age>-1))
                { 
                    groupSize++; 
                    totalCost = totalCost + under16_Free; 
                } 
                else if(age>16) 
                { 
                    groupSize++; 
                    totalCost = totalCost + oap; 
                } 
                else if((age>16)&&(age<=65))
                { 
                    groupSize++; 
                    totalCost = totalCost + other; 
                } 
            } 
            if (groupSize>6) 
            { 
                totalCost = totalCost - (totalCost/5); 
            } 
            Console.WriteLine("Total Cost = " + totalCost); 
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble with a simple table layout in ExtJs 4.0. I have
I'm having trouble adding a button to a layout that I've created in XML.
So, I'm having trouble with a layout. I would like to have the sidebar
I'm having trouble building a layout. My situation is this: I have an Activity
I am having trouble creating a layout for a dialog I want to display
I'm using D3.js and I'm having trouble setting up a stacked layout for an
I am trying to just create a basic layout, but i am having trouble
I'm having a little trouble with RadioGroups. I created a blank radiogroup in layout.
I'm having trouble trying to achieve some very basic layout behavior with Auto Layout.
I'm having trouble getting a time friendly X-axis layout in Gnuplot. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.