Visual Programing (CS411)
Assignment#01 (GRADED)
Total marks = 20
Deadline Date = 09-05-2018
Please read all the instructions carefully before attempting the assignment.
You are required to create a C# application Console using Visual Studio.
Problem Statement:
You are required to create a C# Console application which will read a Text File and print it on Console screen:
Note. Proper Exception handling must be done while opening and reading the files.
Output.gif has been attached with this Assignment file please observe this file carefully your program’s output must be like this output file.
Submission details Following Files Must be submitted in a single zip or rar file. · .C# code file · A .gif file which shows working of your Application(For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well) You are not required to submit the complete project, only copy these three files from project folder. Please note if you submit doc file you will be awarded 0 marks. |
Tags:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Spring_2018_CS411_1
{
class Program
{
static void Main(string[] args)
{
String path=null;
String op=null;
String again=null;
do
{
//Clear COnsole
Console.Clear();
Console.WriteLine("\t\tSpring_CS411_1");
//Ask User to Enter Path
Console.WriteLine("Please Enter file path.");
path = Console.ReadLine();
//Ask user to Read line by line or in ASCII code
Console.WriteLine("Press L to Read line by line and Press H to read Hascode");
op=Console.ReadLine();
//Read Line by Line
if(op == "L" || op == "l")
{
//Read in lines from file.
foreach (string line in File.Readlines(path))
{
//Print on Console after reading from File
Console.WriteLine("{0}");
}
}
//Read in ASCII code
else if (op == "H"|| op == "h")
{
//Read Text from File
String readText = File.readAllText(path);
//Convert Text to ASCII code
byte[] ASCIIValues = Encoding.ASCII.GetBytes(readText);
//Print ASCII code on Console
foreach (byte b in ASCIIValues)
{
//Print ASCII code on Console
Console.ReadLine(b);
}
}
//Ask User to read again or Exit
Console.WriteLine("Press R to read other file and any other key to Exit");
again = Console.ReadLine();
} while (again == "R" || again == "r");
}
}
}
it gives following three errors
(31:50) 'System.IO.File' does not contain a definition for 'Readlines'
(41:44) 'System.IO.File' does not contain a definition for 'readAllText'
(48:25) No overload for method 'ReadLine' takes 1 arguments
i'm also facing these 3 errors .. kindly help about it
'File' does not contain contain a definition for 'ReadLines'.
'File' does not contain contain a definition for 'ReadAllText'
No overload for method 'ReadLine' takes 1 arguments
(31:50) 'System.IO.File' does not contain a definition for 'Readlines'
Solution : replace readlines with ReadLines.
(41:44) 'System.IO.File' does not contain a definition for 'readAllText'
Solution : replace readAllText with ReadAllText
(48:25) No overload for method 'ReadLine' takes 1 arguments
Solution : replace ReadLine with WriteLine.
what to use for userkey to read it as string not int ??
hamara b toh run krwa do bro kaise ho ga errors kaise khtm kron
Assalm-o- Alikum Sir,
kaisey allocate kartey hain address? mujey samj nai a rahi kindly ap mujey mail address dey dein mien apko screenshoot send karta hoon ya ap pls mujey run karwa dein programe mien apko source code send kar deta hoon, pls its my humble request!
i'm also facing these 3 errors .. kindly help about it
'File' does not contain contain a definition for 'ReadLines'.
'File' does not contain contain a definition for 'ReadAllText'
No overload for method 'ReadLine' takes 1 arguments
how to install visual studio iso file. If cant burn it on cd/dvd
Fatal Error: Public Main() method is required in a public class
ye error aa raha ha
bro
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post