Question: Hello, Profs. Please, I need assistance in my c# programming code most precisely on - static void SaveJournal() and class Journal as both FileManager and

Hello, Profs.

Please, I need assistance in my c# programming code most precisely on - static void SaveJournal() and class Journal as both FileManager and entry are both underlined in red.

Here is the prompt that I am getting in both texts and screenshot:

 C:\Users\USER\Desktop\cse210\cse210-projects\prove\Develop02\Program.cs(88,18): error CS0246: The type or namespace name 'Entry' could n ot be found (are you missing a using directive or an assembly reference?) [C:\Users\USER\Desktop\cse210\cse210-projects\prove\Develop02\ Develop02.csproj]


Your help would go a long way in helping me get rid of my c# coding ability and further build my confidence in programming.

Thanks and below is the code in question.

 

 

 

 

 

using System;

using System.Collections.Generic;

using System.IO;


 

class Program

{

    static Journal journal = new Journal();


 

    static void Main(string[] args)

    {

        while (true)

        {

            DisplayMenu();

            string choice = Console.ReadLine();

            switch (choice)

            {

                case "1":

                    AddEntry();

                    break;

                case "2":

                    DeleteEntry();

                    break;

                case "3":

                    DisplayEntries();

                    break;

                case "4":

                    SaveJournal();

                    break;

                case "5":

                    LoadJournal();

                    break;

                case "6":

                    return;

            }

        }

    }


 

    static void DisplayMenu()

    {

        Console.WriteLine("1. Add entry");

        Console.WriteLine("2. Delete entry");

        Console.WriteLine("3. Display entries");

        Console.WriteLine("4. Save journal");

        Console.WriteLine("5. Load journal");

        Console.WriteLine("6. Exit");

    }


 

    static void AddEntry()

    {

        Console.Write("Enter date (MM/DD/YYYY): ");

        string date = Console.ReadLine();

        Console.Write("Enter text: ");

        string text = Console.ReadLine();

        journal.AddEntry(date, text);

    }


 

    static void DeleteEntry()

    {

        Console.Write("Enter entry number to delete: ");

        int index = int.Parse(Console.ReadLine());

        journal.DeleteEntry(index);

    }


 

    static void DisplayEntries()

    {

        journal.DisplayEntries();

    }


 

    static void SaveJournal()

    {

        Console.Write("Enter filename: ");

        string filename = Console.ReadLine();

        FileManager.SaveJournal(journal, filename);

    }


 

    static void LoadJournal()

    {

        Console.Write("Enter filename: ");

        string filename = Console.ReadLine();

        journal = FileManager.LoadJournal(filename);

    }

}


 

class Journal

{

    private List entries = new List();


 

    public void AddEntry(string date, string text)

    {

        entries.Add(new Entry(date, text));

    }


 

    public void DeleteEntry(int index)

    {

        entries.RemoveAt(index - 1);

    }


 

    public void DisplayEntries()

    {

        for (int i = 0; i < entries.Count; i++)

        {

            Console.WriteLine($"{i + 1}. {entries[i].Date} - {entries[i].Text}");

        }

    }

   

}

 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It seems that the error you are encountering is related to the Entry class not being found Thi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!