© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
11 replies
yummy_bee

✅ RPN calculator

I am coding a RPN calculator and I am supposed to do the calculator.view part and I just want to make sure I am doing it right. This is the code I have written so far and I attached the instructions.

//Calculator.view//
using System;
using System.IO;

namespace Calculator.View
{
public class Calculator
{
public string GetRPNString()
{
Console.WriteLine();
return Console.ReadLine();
}
}
}

namespace Calculator.View
{
public class UserInput
{
public void DisplayResult(double ResultString)
{
Console.WriteLine("Result:" + ResultString);
}

public void DisplayError(string ErrorMessage)
{
Console.WriteLine("Error: " + ErrorMessage);
}
}
}

namespace Calculator.View
{
public class FileInput
{
private string FilePath;
public FileInput(string filePath)
{
FilePath = filePath;
}
public string ReadInputFromFile()
{
using (StreamReader reader = new StreamReader(FilePath))
{
return reader.ReadLine();
}

}
}
}

namespace Calculator.View
{
public class FileOutput
{
private string FilePath;
public FileOutput(string filePath)
{
FilePath = filePath;
}
public void WriteOutputToFile(double result)
{
try
{
using (StreamWriter writer = new StreamWriter(FilePath))
{
writer.WriteLine(“Result: “ + result);
}
}
catch (Exception ex)
{
Console.WriteLine(“Error writing to file: “ + ex.Message);
}
}
}
}
tock13_2024_assignment_1_1_1.pdf213.78KB
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ ✅ Calculator
C#CC# / help
3y ago
❔ calculator
C#CC# / help
3y ago
❔ calculator
C#CC# / help
3y ago
Winforms calculator
C#CC# / help
3mo ago