Visual Basic:
Write the code for a function named GetMajor. The function should
prompt the user to enter a major field of study and then return the
user’s response. Then write a statement to invoke the GetMajor
function, returning the result to the strCurrentMajor variable.
Copy and paste the code in your compiler and the results are as expected..... syntax varies according to compiler ... try as your comipler works .... i have executed the code in online compiler...
-------------------------------------------------------------------------------------------
CODE ::
public class compiler
shared function Main as integer ' main function in visual
basic
Dim strCurrentMajor As String 'declare the variable as STRING
type
strCurrentMajor = GetMajor() 'invoking GetMajor function and
returned result is stored in strCurrentMajor variable
Console.WriteLine ("Current Major entered by User is : "
&strCurrentMajor) 'display the user's response returned from
the function
return 0
End function
shared Function GetMajor() As String ' a GetMajor function of
returning type STRING...its a shared function that is, its visible
to other functions
Console.WriteLine("Enter your Major field of Study : ")
Dim input = Console.ReadLine() ' prompt the user to enter a
major
Return input ' returns the users response to the invoked function
call
End Function
end class
-------------------------------------------------------------------------------------------------------------
INPUT :: In online compier ... input need to be given in Input tab of the output window ... depends on your compiler ... if you are using console based compiler then the user can enter input through console
OUTPUT ::
Visual Basic: Write the code for a function named GetMajor. The function should prompt the user...
visual basic calling and returing functins Write the code for a function named CalculateBonus. The function receives two decimal variables representing the salary and bonus rate. The function should calculate the bonus amount by multiplying the salary by the bonus rate, and then return the result. Then write the appropriate statement to invoke the function, passing it the decSalary and decRate variables. Assign the function’s return value to the decBonus variable.
Write a C function named: div() with one local variable: m to prompt the user to enter one integer for the local variable m. When you call the function, it should display one of the following lines: If m is divisible by 9 the function displays the message m is divisible by 9 If m is divisible by 3 and not divisible 9 (e.g. 24) the function displays the message m is divisible by 3 If m is neither divisible...
on a mac!!!!!! Write a script named copyfile.py. This script should prompt the user for the names of two text files. The contents of the first file should be input and written to the second file.
Write a program named program51.py that defines a value-returning function named cuber that returns both the surface area and volume of a cube. A cube is a rectangular prism with all sides equal. Prompt the user to enter the cube's side length from the keyboard in the main function and then call the cuber function. Moving forward for all assignments and for this program, all other code would be in a main function, called at the very end of your...
PYTHON 3.6.1 write a script named copyfile.py. this script should prompt the user for the names of two text files. the contents of the first file should be input and written to the second file.
Write a Visual Basic program to find the sum of five ages provided by the user. Use a Do While loop to prompt and read in a value for each age from the user. After the loop, display the calculated value for the sum on the monitor.
can somebody help me with this please. This is for Visual Basic Write the code for an application that calculates the sum of two integer variables (intVar1, intVar2) and store it in a third integer variable (intSum). You should have two text boxes (txtVar1, txtVar2) and a label (lblSum) to show your result.
8. Write the pseudocode (not C++ code) statements that declares a variable named flavor and prompts the user to enter their favorite flavor of ice cream and stores the user’s input in the flavor variable. Then display their favorite flavor of ice cream back to them.
25. (15 pes) Write the C++ code for a function that receives three double numbers. The function should calculate the average of the three numbers and them returm the result. Name the function conm Name the fornal parameters aumi, nu compAverage function. In addition, write a statement that invokes the compAverage f assigns its arguments: 14.50, 18.72, and S3.1 function and its return value to a double variable named answer. Use the following mumbers as the 26, (5 pts) Write...
For Python | Instructions Write a script named difpy. This script should prompt the user for the names of two text files and compare the contents of the two files to see if they are the same. 1. If they are the script should simply output "Yes". 2. If they are not the script should output "No", followed by the first lines of each file that differ from each other The input loop should read and compare lines from each...