Write a program to create a queue that permits insertion at any vacant location at the rear end.
using System;
public static class Lab6
{
public static void Main()
{
// declare variables
int hrsWrked;
double ratePay, taxRate, grossPay, netPay=0;
string lastName;
// enter the employee's last name
Console.Write("Enter the last name of the employee => ");
lastName = Console.ReadLine();
// enter (and validate) the number of hours worked (positive number)
do
{
Console.Write("Enter the number of hours worked (> 0) => ");
hrsWrked = Convert.ToInt32(Console.ReadLine());
} while (hrsWrked < 0);
// enter (and validate) the hourly rate of pay (positive number)
// *** Insert the code to enter and validate the ratePay
// enter (and validate) the percentage of tax (between 0 and 1)
// *** Insert the code to enter and validate taxRatequestion is to insert the code to enter and validate ratePay and taxPay
Create a program that takes in a sentence from user input, the program then removes the last word and first word in the sentence. The remaining string is converted to upper case then printed out. [Hint: In case there is only two words, an empty line is printed]
Sample run 1: Sample run 2:
Enter a sentence: Hello There Enter a sentence: Happy Thursday Everyone
Output: Output: THURSDAY
What is the output of the following program?
int main() {
char arr[11]="Engineering Programming 2 (EIENP2A)";
printf("%s",arr);
return 0;
Create a program that takes in a student first name and average mark obtained, the system should the group the students using the first letter in their name modulus 10 [ Remember that characters are considered as numeric values, hence ‘J’%10 is a valid calculation ]. For example if the student name is Cena, then the student belongs to group 7 because ‘C’%10 = 7 and if the name was Jack then the student belongs to group 4. The program should further use the group number to get the group lecturer and class date as follows: [Hint: If the result is 0 then the student belongs to group 10]
Using a for loop create a program that will prompts the user for two numbers and then print out a summation list of all the between the two given numbers, starting from the small number to the big number. For negative numbers use brackets when printing the summation
Sample Run1
Enter two numbers: 1 10
Output1: Sum = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
Sample Run2
Enter two numbers: -3 3
Output2: Sum = (-3) + (-2) + (-1) + 0 + 1 + 2 + 3 = 0
Using a for loop create a program that will prompts the user for two numbers and then print out a summation list of all the between the two given numbers, starting from the small number to the big number. For negative numbers use brackets when printing the summation
Write a C# program that calculates the total sales amount of a company agent. In the main method, prompt the user to enter the agent’s name, the number of the units sold by the agent, the cost per unit and the discount percent offered (like 0.1 or 0.2).
A method CalculateSales takes the number of units and the unit cost. The method calculates the total amount of sales by multiplying the number of units times the cost.
Another method CalculateNetSales takes the total amount of sales (calculated in the CalculateSales ) and the discount percent, then it calculates the net sales amount by multiplying the total amount by discount percent then subtracting the total amount of sales from the result of the multiplication.
The main method prints out the agent’s name, the number of units sold and the net sales amount. (You must use placeholders and the currency code inside your print statement).
Printing triangles: Write a program which inputs a positive integer n and outputs an n line high triangle of '*' characters whose right-angle is in the bottom left corner. For example, if 5 is input the output should be
Sample Run1
Enter a positive integer: 5
Output1:
*
**
***
****
*****