Question

Please Help in C#, Let me know if you have any questions. Please make sure the program passes the checks

Checks:

Tasks D Display the contents of patients.txt to the console. 0.00 out of 10.00 O out of 1 checks passed. Review the results b

Question: My code works, it just this needs to be added there which I don't know what I need to do.   

In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));

code given:

using System;

using System.IO;

using static System.Console;

using System.Globalization;

class ReadPatientRecords

{

   static void Main()

   {

      const char DELIM = ',';

      const string FILENAME = "Patients.txt";

      Patient patient = new Patient();

      FileStream inFile = new FileStream(FILENAME, FileMode.Open,FileAccess.Read);

      StreamReader reader = new StreamReader(inFile);

      string recordIn;

      string[] fields;

      WriteLine("\n{0,-10}{1,-18}{2,10}\n", "IdNumber", "Name", "Balance");

      recordIn = reader.ReadLine();

      while(recordIn != null)

      {

        fields = recordIn.Split(DELIM);

        patient.IdNum = fields[0];

        patient.Name = fields[1];

        patient.Balance = Convert.ToDouble(fields[2]);

        WriteLine("{0,-10}{1,-18}{2, 10}", patient.IdNum, patient.Name, patient.Balance.ToString("C"));

        recordIn = reader.ReadLine();

      }

      reader.Close();

      inFile.Close();

   }

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

you should use using (

StreamReader patients = new StreamReader("path:/patients.txt"))

and

above of program

using static System.Globalization.CultureInfo;

and i think you repeat 34 line to 50

and

in line 21

Patient patient = new Patient();

you didnt define "patient" function how to call it?

Add a comment
Know the answer?
Add Answer to:
Please Help in C#, Let me know if you have any questions. Please make sure the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Help In C# CHECKS: Program outputs score before and after bonus Method GiveBonus is overloaded Output:...

    Help In C# CHECKS: Program outputs score before and after bonus Method GiveBonus is overloaded Output: It has to look exactly like that Output Scores was 82.Now it is 5. Grade was B Now it is + --------------------------------------------------------------------- DebugEight2.cs has syntax and/or logical errors. Determine the problem(s), and fix the program. CODE: // Overloaded method gives bonus points // whether grade is a number or letter using static System.Console; class DebugEight2 { static void Main() { int numericScore = 82;...

  • Use a C# In previous chapters, you have created programs for the Greenville Idol competition. Now...

    Use a C# In previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing, Dancing, Musical instrument, and Other. Name these fields talentCodes and talentStrings respectively. The class contains an auto-implemented property Name that holds a contestant’s name. The class contains fields for a talent code (talentCode) and description (talent)....

  • using C++ language!! please help me out with this homework In this exercise, you will have...

    using C++ language!! please help me out with this homework In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...

  • Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you....

    Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you. Phase 1 You must design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms.    Algorithm descriptions: Given an integer parameter named current_number and two constant global variables: const int MIN_NUMBER = 1; const int MAX_NUMBER = 8; Create an algorithm named forward, that will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In...

  • it's 20 questions. please let me know if you have any questions and use dimensional analysis...

    it's 20 questions. please let me know if you have any questions and use dimensional analysis that is for example ml/mg= ml/mg*mg/hour... etc. I hope you understand what am trying to say. ** 464 47% 2 9:50 PM Read Only - You can't save changes to t... 1. ficardialrican writes are cruder for traine 0.1 mg/kg civery 4 hours. The available: dois 2mg/ml. The morphine is to be given to a child who welchs 55 pounds. How many ml will...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • For the following task, I have written code in C and need help in determining the...

    For the following task, I have written code in C and need help in determining the cause(s) of a segmentation fault which occurs when run. **It prints the message on line 47 "printf("Reading the input file and writing data to output file simultaneously..."); then results in a segmentation fault (core dumped) I am using mobaXterm v11.0 (GNU nano 2.0.9) CSV (comma-separated values) is a popular file format to store tabular kind of data. Each record is in a separate line...

  • Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one me...

    Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one menu item called Search. Clicking on search should prompt the user using a JOptionPane input dialog to enter a car make. The GUI should then display only cars of that make. You will need to write a second menu...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT