|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with Homework
I missed 2 weeks of school due to a family member passing away. I am in computer programing 101. I have completed the first two assignments but desperately need help on how to make this simple program.I would be gratefull if someone can help me please.
Congratulations, you?re going to the moon. Really. In fact, you?ve been appointed Flight Commander. As you might guess, weight is a critical factor in the overall success of your mission. As Commander, you need to carefully screen your crew for weight minimums and maximums. An astronaut must weigh at least 75 kgs (kilograms) and no more than 85 kgs. You have just one candidate you must interview. Unfortunately, your potential astronaut doesn't know his or her weight in kgs, only pounds. The program you develop must therefore allow the user to input their name, their weight in pounds, do the conversion to convert pounds to kgs, and then output one of three possible messages: Sorry, ___ kilograms is too light, Congratulations, ___ kilograms meets the weight requirement, or Sorry, ___ kilograms is too heavy. Note that response 1 is only displayed if the weight is less than 75 kgs, and response 2 is only displayed if the weight is 75-85 kgs. Response 3 display only if the weight is over 85 kgs (fill in the ___ with the actual value for kgs). Finally, when the input of the potential astronaut's weight is finished, your program should output a summary of the weight of the astronaut in pounds and in kilograms, with an extra message for the candidate if they are too heavy indicating just how much weight in pounds they must loose to be within range; and the same for the potential astronaut who is too light, displaying a message of how many pounds they must gain before they are eligible. HINT: 1 pound = 0.4535 kilograms |
|
#2
|
|||
|
|||
|
Usually homework question elicits only humorous replies, if any at all.
Now, if you've started your vb code and have a section that's giving you a problem, and if you ask a clear and lucid question including code snips, error messages, and an explanation of the problem, you'll likely get helpful responses. If you want someone to do your homework for your, well, we know what that's called in school ...
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Ok
Ok I understand. Can some help me on how to star off a least. I just want to get it started. I will admit that I am confused but for Now I just need someone to get me started.
|
|
#4
|
|||
|
|||
|
Quote:
Sure, I'll give you a push in the right direction! If you want, create 2 textboxes for the input (name and weight in pounds). From the input given in the weight textbox, find out how many kilograms it equates to, you can do this by multiplying the input pounds by 0.4535. Since you now have the weight in kilograms, you can check if the person is under, over, or meets the weight requirement. You could do this several ways, I would probably use Select Case, it looks clean in my opinion. Now, just based upon the weight (<75, >85, >75 & <85 ) you can use message box to show the result of the person. Although, the part of the assignment asking for the name input is rather inane, since it doesn't actually use it anywhere. Hope that helped, -Alias |
|
#5
|
|||
|
|||
|
Need Help Please
This is what I can come up with. Please help me.
Module Module1 Sub Main() ' Nasa pre-filght, version 1.0 Dim Number As Integer Dim Weight As Integer Dim ShowMe As String Number = 75 Or 85 Console.WriteLine("Welcome to the Nasa!") Console.WriteLine("Enter your weight:") Weight = Integer.Parse(Console.ReadLine()) If Weight < 75 Or Weight > 85 Then Console.WriteLine("You weight out of range!") ElseIf Weight = Number Then Console.WriteLine("Congratulations! You weight is perfect!") Else Console.WriteLine("Too bad. Your weight is off.") Console.WriteLine("Do you want to know what you need to weigh (Y/N)") ShowMe = Console.ReadLine() If ShowMe = "Y" Then Console.WriteLine("You need to weigh 75 to 85" & Number) End If End Sub End Module |
|
#6
|
|||
|
|||
|
What happens when you try your code? Do you get errors?
|
|
#7
|
|||
|
|||
|
I'll give you your solution, since you've been asking nicely, and had family member pass away.
This is VB6: >>2 TextBoxes - 1. txtName 2. txtWeight >>1 Command Button - 1. btnWeightCheck Code:
VB6
Private Sub btnWeightCheck_Click() Dim weightKG As Double weightKG = txtWeight.Text * 0.4535 Select Case weightKG Case Is < 75 MsgBox "Sorry " & txtName.Text & ", but you're below the weight requirements.", vbOKOnly, "Underweight" Case Is > 85 MsgBox "Sorry " & txtName.Text & ", but you're above the weight requirements.", vbOKOnly, "Overweight" Case Is > 75 < 85 MsgBox "Congratulations " & txtName.Text & ", you meet the weight requirement!", vbOKOnly, "Perfect!" End Select End Sub |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Help with Homework |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|