Could someone help me on the For loop in this program(I have broke this up to make it easy to read)?
-
This is the program I am createing , I have the broke up part below and below the sections I name is my actual partually completly code 2/3 is done and I am now stuck on doing the for loop. Could someone please explain how one works and what lines of code I need to get this running. I am using visual studios 2005 it is visual basic porgramming language Part 1: Create the following console application Name this project Marks. Create a console application for the following problem. • Place a title on the screen “Marks Program by Your Name” • Prompt the user: “Do you want to calculate average marks (Y/N)?” • If the user enters a Y/y, the program will prompt “How many marks (3-6)?” and read an integer between 3 and 6. Use a do while pre-test loop to get a valid number, displaying an invalid message if necessary. Use constants for 3 and 6. Once you get a valid number, read in that many marks (single) from the user and find the average. Marks entered must be between 0.0 and 100.0. Keep reading marks until they are in that range. Use a for loop to read in the marks. Display the following on the screen: “n marks entered and the average is nn.nn”, where n represents the number the user entered and nn.nn represents the average. • If the user enters an N/n, the program will end. • If the users enters anything besides a Y/y or N/n, display invalid and re-prompt “Do you want to calculate average marks (Y/N)?” • Hand in pseudocode by Tuesday, Nov. 4 at 8:30 am. (5 marks) • Pseudocode must be typed in Word with your name on it. Your test cases are as follows with messages: Marks Program by Your Name Do you want to calculate average marks (Y/N)? X Invalid option, please try again Do you want to calculate average marks (Y/N)? y How many marks? (3-6): 14 Invalid number of marks, choose (3-6): 4 Enter mark 1: -17 Error - marks must be between 0 - 100: 120 Error - marks must be between 0 - 100: 67.5 Enter mark 2: 73.5 Enter mark 3: 76.5 Enter mark 4: 96.5 4 marks entered and the average is 78.5 Do you want to calculate average marks (Y/N)? Y How many marks? (3-6): 3 Enter mark 1: 77 Enter mark 2: 84 Enter mark 3: 63 3 marks entered and the average is 74.66666 Do you want to calculate average marks (Y/N)? N Press any key to continue . . . mports System.console Module Marks Sub Main() Dim choice As Char Dim num As Integer Const MIN As Integer = 3 Const MAX As Integer = 6 Dim counter As Integer Dim WriteLine("Marks program by Brian Murphy") WriteLine() Do Until choice = "n" Or choice = "N" Write("Do you want to calculate average marks (Y/N)? ") choice = ReadLine() Select Case choice Case "Y", "y" Write("How many marks? (3-6): ") num = ReadLine() Do While num < MIN Or num > MAX Write("Invalid number of Marks , choose (3-6): ") num = ReadLine() Loop For counter = 1 To num Write(":") Next Case "N", "n" 'end program Case Else WriteLine(" Invalid option , please try again") End Select Loop End Sub End Module
-
Answer:
You forgot to tell what is your problem, when you say "broken" what it means ?? (not working? not compiling? not giving correct answer?............)
Brian M at Yahoo! Answers Visit the source
Related Q & A:
- Can someone help me find a study abroad program?Best solution by Yahoo! Answers
- Can someone help me with my psp warranty?Best solution by Yahoo! Answers
- Can someone help me locate an orphanage in Israel?Best solution by Yahoo! Answers
- Can someone help program this for me?Best solution by Yahoo! Answers
- I really need some help writing my personal statement for a nursing program.Best solution by cmu.edu
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.