{"id":34744,"date":"2025-06-23T18:52:18","date_gmt":"2025-06-23T18:52:18","guid":{"rendered":"https:\/\/gaviki.com\/blog\/?p=34744"},"modified":"2025-06-23T18:52:20","modified_gmt":"2025-06-23T18:52:20","slug":"for-each-lab-program-you-develop-make-sure-to-include-the-following-header-replace-the-dots-with-your-section-number-semester-your-full-name-your-instructors-name-and-lab-number","status":"publish","type":"post","link":"https:\/\/gaviki.com\/blog\/for-each-lab-program-you-develop-make-sure-to-include-the-following-header-replace-the-dots-with-your-section-number-semester-your-full-name-your-instructors-name-and-lab-number\/","title":{"rendered":"For each lab program you develop, make sure to include the following header &#8211; replace the dots with your section number, semester, your full name, your instructor&#8217;s name, and lab number"},"content":{"rendered":"\n<p>For each lab program you develop, make sure to include the following header &#8211; replace the dots with your section number, semester, your full name, your instructor&#8217;s name, and lab number: Class: CSE 1321L Section: Term: Instructor: Name: Lab#: Make sure to put the correct comment characters before the above lines in each file. C# &amp; Java use \/\/ for comments. Lab2A: MadLibs. For this assignment, we&#8217;re going to code a MadLib. Your program should ask the user for two names, a verb and an adverb. These responses will get plugged into a pre- written sentence. An example output is shown below. User input is denoted in bold. Both the class and filename should be called Lab2A (.java, .cs, .cpp). Sample run: Enter a name: Tiffany Enter another name: Bubba Enter a verb: eat Enter an adverb: wickedly Once upon a time, there was a person named Tiffany who had a child named Bubba. This child would eat wickedly while singing to strangers.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">The Correct Answer and Explanation is:<\/mark><\/strong><\/p>\n\n\n\n<p>Here is the correctly formatted C# version of <strong>Lab2A: MadLibs<\/strong>, including the required header and sample implementation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">csharpCopyEdit<code>\/\/ Class: CSE 1321L\n\/\/ Section: [Your Section Number]\n\/\/ Term: [Your Semester]\n\/\/ Instructor: [Your Instructor's Name]\n\/\/ Name: [Your Full Name]\n\/\/ Lab#: Lab2A\n\nusing System;\n\nclass Lab2A\n{\n    static void Main(string[] args)\n    {\n        Console.Write(\"Enter a name: \");\n        string name1 = Console.ReadLine();\n\n        Console.Write(\"Enter another name: \");\n        string name2 = Console.ReadLine();\n\n        Console.Write(\"Enter a verb: \");\n        string verb = Console.ReadLine();\n\n        Console.Write(\"Enter an adverb: \");\n        string adverb = Console.ReadLine();\n\n        Console.WriteLine(\"Once upon a time, there was a person named \" + name1 + \n                          \" who had a child named \" + name2 + \n                          \". This child would \" + verb + \" \" + adverb + \n                          \" while singing to strangers.\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Explanation <\/h3>\n\n\n\n<p>This lab assignment requires the creation of a simple <strong>MadLibs-style<\/strong> program in C#. The program begins by displaying four prompts to the user, asking for two names, one verb, and one adverb. These inputs are then stored in variables and used to complete a fixed sentence with dynamic content.<\/p>\n\n\n\n<p>The use of <code>Console.Write<\/code> allows the user to input their responses on the same line as the prompt, making the interface cleaner. Each input is read using <code>Console.ReadLine()<\/code> and stored in variables <code>name1<\/code>, <code>name2<\/code>, <code>verb<\/code>, and <code>adverb<\/code>.<\/p>\n\n\n\n<p>The final output sentence is constructed by concatenating the static story text with the user inputs. This demonstrates how user-provided data can be integrated into prewritten content. The goal is to make the output funny or creative, depending on the words the user provides.<\/p>\n\n\n\n<p>In terms of syntax, the header is formatted using the <code>\/\/<\/code> comment symbol required in C#. This ensures that metadata such as course number, section, and student name are well documented at the top of the code, which is a common requirement in academic settings.<\/p>\n\n\n\n<p>The program illustrates several core programming concepts. These include console input and output, variable declaration, string manipulation, and basic program structure with the <code>Main<\/code> method. For new programmers, this lab is a useful exercise in understanding how to collect input and dynamically produce output based on user data. It sets the foundation for later work with functions, conditionals, and loops.<\/p>\n\n\n\n<p>By encouraging creativity through word choice, this lab also makes the learning process more engaging and memorable.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"1024\" src=\"https:\/\/gaviki.com\/blog\/wp-content\/uploads\/2025\/06\/learnexams-banner10-298.jpeg\" alt=\"\" class=\"wp-image-34745\" srcset=\"https:\/\/gaviki.com\/blog\/wp-content\/uploads\/2025\/06\/learnexams-banner10-298.jpeg 722w, https:\/\/gaviki.com\/blog\/wp-content\/uploads\/2025\/06\/learnexams-banner10-298-212x300.jpeg 212w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>For each lab program you develop, make sure to include the following header &#8211; replace the dots with your section number, semester, your full name, your instructor&#8217;s name, and lab number: Class: CSE 1321L Section: Term: Instructor: Name: Lab#: Make sure to put the correct comment characters before the above lines in each file. C# [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34744","post","type-post","status-publish","format-standard","hentry","category-quiz-questions"],"_links":{"self":[{"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/posts\/34744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/comments?post=34744"}],"version-history":[{"count":2,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/posts\/34744\/revisions"}],"predecessor-version":[{"id":34747,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/posts\/34744\/revisions\/34747"}],"wp:attachment":[{"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/media?parent=34744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/categories?post=34744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaviki.com\/blog\/wp-json\/wp\/v2\/tags?post=34744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}