• 0

[C#] "class name is not valid at this point" error


Question

Hey guys,

I'm trying to call a method with 1 argument. However, no matter where I call the method, I get an error saying "class name is not valid at this point."(and in certain places, I also get an error saying "redundant empty statement") The argument I'm calling is a class variable.

Here is my code so it makes a bit more sense with what I'm trying to say

PrintReceipt(Pump aPump);	//Method I'm trying to call

		public static void PrintReceipt(Pump aPump)	//The actual method
		{
			const double amountDispensed = 0;
			DateTime currTime = DateTime.Now;

			Console.WriteLine("\nAUTOMATED FUEL DELIVERY SYSTEM");
			Console.WriteLine("\nRECEIPT");
			Console.WriteLine("\nDate : {0:d}", currTime);
			Console.Write("\nPaid for {1:#.##} litres of ", aPump.getPrice(), amountDispensed);
		}

If anyone can help me out, that'd be great.

Thanks in advance,

Britt.

6 answers to this question

Recommended Posts

  • 0
  Pc_Madness said:
I think I see her problem,

PrintReceipt(Pump aPump);

Is that how your calling the function? You don't need to include the data type (aka Pump) when calling functions.

PrintReceipt(aPump);

should do the job. :)

Thanks for the reply guys!

Pc_Madness, I've tried that, and it throws an error saying a ')' is expected.

  ork said:
If you can post your complete usage in the class maybe i can help. You can snip method implementations if they are large to post.

Yep I'll post my code up

  • 0

            // Scenario 1 - Enter cash limit 
            if (aSystem.getCardReader().getCardSatus() == SystemController.CardStatus_Valid)
            {

                Pump aPump = customer1.getPump();
                // Fuel selection
                aPump.setFuelType(FuelPriceType.Unleaded);
                // set cash
                aPump.setPrice(40);       
                // check credit limit
                // check fuel price with customers selection
                if (customer1.getCreditLimit() > aPump.getPrice())
                {
                    double fuelDelivery = aPump.getPrice() / FuelPriceType.UnleadedPrice;

                    aPump.activate();
                    if (aTank.getTotalLevel() > fuelDelivery)
                    {
                        aPump.setFuelDispensed(fuelDelivery);
                    }
                    PrintReceipt(Pump aPump);
                    aPump.deactivate();
                    aTank.removeFuel(fuelDelivery);
                    customer1.setCreditLimit(customer1.getCreditLimit() - aPump.getPrice());
                    DateTime currTime = DateTime.Now;

Correction: it's no longer throwing the original error which I posted about, however, it's still saying that a ')' is expected even when I include the data type (which is Pump in this case)

  • 0

Where abouts is it saying that the ) is expected? I can't see any missing brackets from the code you've posted.

You definitely don't need to include the data type when calling your function. I don't even know how that could compile to be honest since I would think that it would have a bitch about you declaring a variable with the same name in the same scope. (you're basically passing PrintReceipt a blank Pump)

Edit: Go away wrack you crazy fellow. :p

p.s. Hi :p

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Summary for all: Some WD SSDs need firmware updates for 24H2.
    • Next-gen AMD GPUs reported to support HDMI 2.2 with up to 80Gbit/s bandwidth by Aditya Tiwari Some beans have spilled around AMD's rumored upgrades for its next-generation graphics architecture. The American silicon giant is expected to support up to 80 Gbps mode on HDMI 2.2 for its upcoming graphics architecture, internally codenamed GFX13, and expected to launch as RDNA 5 or UDNA. The latest information comes from the leaker @Kepler_L2, who took to their social media account on X (via VideoCardz). It strengthens the hopes of the latest HDMI standard and support for faster bandwidth making their way to the next generation of AMD GPUs. The HDMI 2.2 standard was announced earlier this year and released to manufacturers in the first half of 2025. It pushes the maximum allowed bit rate to 96 Gbps and supports Latency Indication Protocol (LIP) to improve audio and video synchronization. However, according to Kepler's post, RDNA 5 GPUs are expected to support only 64 Gbps and 80 Gbps modes. This suggests that the 96 Gbps mode may not be supported on the new architecture, while it remains unclear whether this is due to some hardware limitation or will be added later. Although the new piece of information pertains to GFX13, it doesn't clarify whether it's related to the PRO or Radeon RX series. The company has previously used UHBR 13.5 (54 Gbps) for its consumer-focused GPUs to reduce costs while supporting UHBR 20 (80 Gbps) on PRO cards, according to the leaker. It remains to be seen whether AMD treats the two product lines the same or differently. Another standard announced earlier this year was DisplayPort 2.1b, which keeps the same maximum bandwidth of 80 Gbps but supports three times the cable length for UHBR20 GPU-to-display connections compared to existing VESA-certified DP80 passive cables. The new standard is supported on NVIDIA's RTX 50 and RTX PRO Blackwell series GPUs. For now, there is no update on whether AMD will bring DisplayPort 2.1b support to the GFX13 architecture.
    • Meanwhile Honda just had a successful reusable rocket test, should be a thread about them and not this maniacal maniacs madness https://interestingengineering.com/space/honda-stuns-world-with-reusable-rocket-launch
    • Jesus…. dont you know who Jesus is? my god… are you for real?
  • Recent Achievements

    • First Post
      MikeK13 earned a badge
      First Post
    • One Month Later
      OHI Accounting earned a badge
      One Month Later
    • Week One Done
      OHI Accounting earned a badge
      Week One Done
    • First Post
      Thornskade earned a badge
      First Post
    • Week One Done
      Higante88 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      711
    2. 2
      ATLien_0
      270
    3. 3
      Michael Scrip
      202
    4. 4
      +FloatingFatMan
      179
    5. 5
      Steven P.
      128
  • Tell a friend

    Love Neowin? Tell a friend!