C# Answers

Questions answered by Experts: 1 362

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a program that can be used by a vendor of a budget store to calculate and display the number of items bought and the total amount due by a customer (display the total as currency with 2 decimal places). Your program must continuously prompt the user for the price of an item, until a valid number (between 0 and 150) is entered. As you do not know how many items the customer is buying, the vendor must be able to continuously item prices, until he enters a value of -1 to indicate that there are no more item prices to enter.

Customers buying at least 10 items qualify for one free item. When a customer qualifies for the free item, a relevant message must be displayed.

You do not need to create any user defined methods.



Write a program that can be used by a vendor of a budget store to calculate and display the number of items bought and the total amount due by a customer (display the total as currency with 2 decimal places). Your program must continuously prompt the user for the price of an item, until a valid number (between 0 and 150) is entered. As you do not know how many items the customer is buying, the vendor must be able to continuously item prices, until he enters a value of -1 to indicate that there are no more item prices to enter.

Customers buying at least 10 items qualify for one free item. When a customer qualifies for the free item, a relevant message must be displayed.

You do not need to create any user defined methods.



Write a program that can be used to determine the total amount a family needs to pay for bus tickets. The
price for a bus ticket is linked to the age of the passenger, as indicated in the table below:

Age price
Younger than 2 $ 50
2 - 12 $100
13 or more $ 180

The program must prompt the user for the number of family members who will be travelling on the bus. For
each travelling member the age must be entered, and the price determined and displayed. When all family
members have been processed, the total amount due must be displayed. Monetary amounts must be
displayed with currency formatting. (You may assume that only valid ages will be entered)

Write a program that can be used to determine the total amount a family needs to pay for bus tickets. The price for a bus ticket is linked to the age of the passenger, as indicated in the table below:

  Age

Younger than 2 2 - 12

13 or more

Ticket price

R 50 R 100 R 180

    The program must prompt the user for the number of family members who will be travelling on the bus. For each travelling member the age must be entered, and the price determined and displayed. When all family members have been processed, the total amount due must be displayed. Monetary amounts must be displayed with currency formatting. (You may assume that only valid ages will be entered)


Q.No.1. There are total 50 employees working in XYZ organization who have a policy of Bonus via lucky draw. They want to automate the process to select employees randomly for lucky draw.     

Write code for a console application where you have to declare an integer array that store employee numbers. Employee number will be provided as input to a function fillEmployee(int eNum). Make sure, employee number, must be 4 digit unique number otherwise repeat the process till you get valid input.  

Now the company wants to announce employee through a Lucky Draw. You are required to generate random 4 digit employee number and compare with existing employee numbers (using Random class of C#). Repeat the process till you match a valid employee number and then print “congratulation” message along with winner’s employee number. 



You are required to code for “Students attendance” system to keep record of attendance of complete semester.    

Write a class AttendaceRecord having properties section, regNumber, studentName, AttendanceStatus (a char either P or A) and a function to mark attendance. Also create a List of type AttendanceRecord and call the required function/s to mark attendance when required. The system should be able to perform the following functions:

·        View attendance record of given student to show Student name, Registration number, percentage of total presents/absents and total attendance record (so far)

·        Calculate Short attendance to display all those students whose attendance is below the given threshold value (given in percentage).



Jack and his three friends have decided to go for a trip by sharing the expenses of the

fuel equally. Implement a C# method CalculateCostPerPerson(double mileage, double amountPerLitre, int distanceOneWay) which returns the amount (in Rs) each of them need to put in for the complete (both to and fro) journey.

Mileage of the vehicle (km/litre of fuel) - 12

Amount per litre of fuel (Rs) - 65

Distance for one way (kms) - 96

expected output = 260




Let’s build a sample banking program to perform the common tasks like Withdraw and Deposit. Task 1: Create a class library project and Add a Class called BankAccount. This class needs to implement the IBankAccount Interface. Task 2: Define a enum as follows. This enum will be used as


Write a program that reads in 10 midday temperatures for Port Elizabeth, for 10 consecutive days. 

Only temperatures higher than 0 and less than 45 are valid (working with integer values for 

temperatures). It must calculate and display the following: 

 The warmest temperature

 The average temperature.

 The number of days that the temperature was higher than 30.


Create a new application that performs a shift and replacement of the letters in a string and then prints the result. The Main method of the application is provided below. Your task is to define the Shift and Replace methods that are called from Main. static void Main(string[] args) { string sAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Console.Write("Enter any word: "); string sInput = Console.ReadLine(); Console.Write("Enter n: "); int n = int.Parse(Console.ReadLine()); string sShift = Shift(sInput, n); Console.WriteLine("\n" + Replace(sShift, n, sAlphabet)); Console.Write("\nPress any key to exit."); Console.ReadKey(); } Shift accepts two parameters and returns a string in which all the characters of a string (first parameter) have been shifted n (second parameter) places to the right, with the last n letters looping back around to the beginning. For example, if the user enters ZUCCHINI for sInput and 3 for n, Shift must return INIZUCCH.


LATEST TUTORIALS
APPROVED BY CLIENTS