Questions: 1 835

Answers by our Experts: 1 539

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 & Filtering

How do you display an error message written like this: (“101 is not a valid mark, enter a number between 0 and 100”) in this code?


1. Write a program to declare a structure and inside it is a non-static method that returns the area of a rectangle.

 

Test Data and Sample Output:

Input the dimensions of a rectangle:

Length: 60

Width: 30

Expected Output:

Length: 60

Width: 30

Area: 1800



Write a user defined method named getMark that can be used to get a valid mark from the user. 

Your method must continuously ask the user for a mark, until a valid mark is entered (valid marks 

are between 0 and 100). If a user enters an invalid mark, display an error message before asking 

for a valid mark to be entered. The method must return the valid value to the calling program.

Write a user defined method named isPass that can be used to determine whether a mark is a 

pass mark (greater or equal to 50). The method must take as input a mark, and return a boolean, 

indicating whether the mark was a pass mark.

Write a program that reads in 5 marks by using the getMark method to ensure that valid marks are 

processed. You need to calculate the sum and the average of the marks. Your program must also 

use the isPass method to determine the number of pass marks entered. When the 5 marks have 

been processed you need to display the sum, average and number of passes (from these marks).


1- Consider the following set of processes, with the length of the CPU-burst time given in

milliseconds:


Process burst Time Priority

P1 10 3

P2 1 1

P3 2 3

P4 1 4

P5 5 2


a. Draw a Gantt chart to show how these processes would be scheduled.

b. Give the turnaround time (total time from first arrival into ready state until CPU-burst

is completed) of each process.

c. Give the waiting time (total time spent in the Ready state) of each process.

d. Give the average waiting time of all the processes.

e. Create Program for SJF for above data.


2- Suppose the following three processes arrive for execution at the arrival times

indicated.


Process Arrival Time Burst Time

P1 0.0 8

P2 0.4 4

P3 1.0 1


a. Develop code for SJF scheduling using above given data.



3.1 Write a function named "reverse” that takes as its arguments the following:

(a) an array of floating point values; (15)

(b) an integer that tells how many floating point values are in the array. (15)

The function must reverse the order of the values in the array.


Thus, for example, if the array that's passed to the function looks like this:

0 1 2 3 4

5.8 | 2.6 | 9.0 | 3.4 | 7.1


then when the function returns, the array will have been modified so that it looks like this:


0 1 2 3 4

7.1 | 3.4 | 9.0 | 2.6 | 5.8

The function should not return any value.


The user should enter the following values: Gross monthly income (before deductions) Estimated monthly tax deducted,Estimated monthly expenditures in each of the following categories,Groceries,Water and lights Travel costs (including petrol),Cell phone and telephone,Other expenses. The user shall be able to choose between renting accommodation or buying a property. 3. If the user selects to rent, the user shall be able to enter the monthly rental amount. 4. If the user selects to buy a property, the user shall be required to enter the following values for a home loan: a. Purchase price of the property b. Total deposit c. Interest rate % d. Number of months to repay (between 240 and 360) 5. The software shall calculate the monthly home loan repayment for buying a property based on the values that the user entered If the monthly home loan repayment is more than a third of the user’s gross monthly income, the software shall alert the user that approval of the home loan is unlikely. NB:MAKE USE OF GENERIC CLASSES


You will continue working on the application created in Part 1. Implement the feedback provided by your lecturer on Part 1 before continuing with Part 2. Marks will be awarded for this (10%).



The application must still perform all the functions from Part 1, with the following features added: 1.



The user shall be able to choose whether to buy a vehicle.



2.



If the user selects to buy a vehicle, the user shall be required to enter the following values



for vehicle financing:



a. Model and make. b. Purchase price.



c. Total deposit.



d. Interest rate (percentage).



e. Estimated insurance premium.



3.



The software shall calculate the total monthly cost of buying the car (insurance plus loan



repayment). Assume that all cars will be repaid over a period of five years.



4. The software shall notify the user when the total expenses exceed 75% of their income,



including loan repayments.



Display the expenses to the user in descending order by value.

Make a class named Fruit with a data member to calculate the number of fruits in a basket. Create twoother class named Apples and Mangoes to calculate the number of apples and mangoes in the basket.Print the number of fruits of each type and the total number of fruits in the basket. c#


When should you use a structure?Why?

“Our state of the art algorithm allows you to simply input the width and height of your skyscraper, and using a specially trained machine learning model, it would automatically generate a “star” (*) image of the entire structure. Specifically, the foundation of the building would always be width + 2 stars wide, while the top of the tower contains 1 star if the width is an odd number, or 2 stars if the width is an even number. Are you ready to see how it works?”



Apart from the base and the top level of the tower, every level starts and ends with a white space(" ").




The first line will contain a message prompt to width of the skyscraper.




The second line will contain a message prompt to height of the skyscraper.





The succeeding lines will contain the skyscraper pattern.



For example:





Output:





Enter·width·of·skyscraper:·5




Enter·height·of·skyscraper:·10




*




*****




*****




*****




*****




*****




*****




*****




*****




*******

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS