Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

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

Temperature Conversion

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature (a number) and the unit of the temperature scale (C, F, K) without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.Input


The first line of the input contain a temperature Value in one of Celsius, Fahrenheit, and Kelvin scales.Output


The first line of output should contain the Celsius value and the unit of the Celsius without any space.

The second line of output should contain the Fahrenheit value and the unit of the Fahrenheit without any space.

The third line of output should contain the Kelvin value and the unit of the Kelvin without any space.Explanation


For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K.

Sample Input 1

25C

Sample Output 1

25.0C

77.0F

298.0K

Sample Input 2

37.5F

Sample Output 2

3.06C

37.5F

276.06K


Create a program which has:

1. The following arrays created:

               a. an array of double with 5 elements, dArr

               b. an array of long, lArr, with 7 elements and initialized at the time of creation with the values

                                               100000, 134567, 123456, 9, -234567, -1, 123489

               c. a 2 dimensional array of integer, with 3 rows and 5 columns, iArr.

               d. an array of char with your name initialized in it. Big enough for 30 typable characters, sName.

2. define 3 variables, , cnt1 and cnt2 (short data types) as general purpose counters and a long double total

3. define 1 long variable called highest

4. a for loop to put a random number into each of the elements of the array of double, dArr. Use rand() and seed a random starting point with srand() as demonstrated in Chapter . Use a for loop to display all of the values in dArr.             

5. another for loop to add up the array of double, dArr, into the variable total

6. one cout to print the total and another cout to print the average of the double array, dArr.

7. a for loop similar to the following for the long array, lArr:

                               for ( cnt1 = 1, highest = lArr[0] ; cnt1 < 7 ; cnt1++ )

                               {

                                               //logic to compare each array element, starting with lArr[1], with highest

                                               //replace highest if the value in lArr[cnt] is higher than the value in variable highest

                               }

8. a cout to print highest as derived in the above code        

9. a for loop to put a random number, each with a value no lower than 1 and no higher than 53, into each element of iArr, the array of integer, seed the random generator with srand( (unsigned) time(NULL)). Only have to run srand once…. Use the modulo operator similar to the way you did with dice rolls in Project 2.

10. a separate loop to print iArr with 3 rows on your screen. Each row has 5 numbers. Use setw to control the width of each column. See Chapter 3 for an example of a program using setw. Print row by row.

11. a loop to print the 2 dimensional array, iArr, so that all 3 numbers in column 0 are printed and then on the next line all 3 numbers in column 1, etc. thru column 4. Print column by column.

12. Use cin.getline( ...... ) to type another name into the variable sName. You must use getline with cin to allow space between first and last name.

13. Print the ascii value of each character in the char array, 1 per line. Use a while loop and look for the '\0' as a signal to end. Refer to the code in myCourses.

14. make the array of char, sName, have the name "Albert Einstein" in it. You must use strcpy_s function.

15. print the ascii value of the 12th character of the string sName

 



. Write a class program to calculate the parking fare for customers who park their vehicles in a parking lot. Prompt user to enter the following information: vehicle info, hour’s vehicle entered the lot and hours vehicle left the parking lot; you are to assign the parking fee as 1hr 100 naira.  





Why Is Method main Declared static?


Plot the following functions on the same graph for x values from -π to π. selecting spacing to create a smooth plot: y1 = sin (x) y2 = sin(2x) y3 = sin(3x)


Sort the sequence 40 6 18 20 99 5 21 43 3 by hand with (you may upload you hand writing sketches): write the time complexity for each sorting method.

1. Insertion sort

2. Selection sort

3. Quicksort (picking the last element as the pivot)

4. Quicksort (using the median-of-three pivot)

5. Heap sort


Questions

• Consider a bit streaming scenario for a video where the 

following values apply:

– The buffer size is 1 MiB

– The low watermark is set at 100KiB

– The high watermark is set at 900KiB

– The incoming data rate is 1Mbps

– The video display rate is 300 Kbps

All material presented in this course is based on the 

book by D. Dalcher and L. Brodie Successful IT 

projects


Create a class RationalNumber that stores a fraction in its original form (i.e. without finding the 

equivalent floating pointing result). This class models a fraction by using two data members: an integer 

for numerator and an integer for denominator. For this class, provide the following functions: 

a) A no-argument constructor that initializes the numerator and denominator of a fraction to 

some fixed values. 

b) A two-argument constructor that initializes the numerator and denominator to the values sent 

from calling function. This constructor should prevent a O denominator in a fraction, reduce or 

simplify fractions that are not in reduced form, and avoid negative denominators. 


c) A showRNt) function to display a fraction in the format a/b. 

d) Provide the following operator functions as non-member friend functions. 

i. An overloaded operator + for addition of two rational numbers. 


Two fractions a/b and c/d are added together as: 

£ + £ _ (a*d)+(b*c) 

b d b “ d 

ii. An overloaded operator - for subtraction of two rational numbers. 

Two fractions a/b and c/d are subtracted from each other as: 

£_£=W 

b d b * d 

iii. An overloaded operator * for subtraction of two rational numbers. 

Two fractions a/b and CM are multiplied together as: 

a * c _ a * c 

b d_b*d 

iv. An overloaded operator / for division of two rational numbers. 

If fraction a/b is divided by the fraction c/d, the result is 

i _ a * d 

b / fi b * c 

v. Overloaded relational operators 

a.operator >: should return a variable of type bool to indicate whether 1" fraction 

is greater than 2"‘1 or not. 

b.0perator <: should return a variable of type bool to indicate whether 1" fraction 

is smaller than 2"“ or not. 

c.0perator >=: should return a variable of type bool to indicate whether 1St 

fraction is greater than or equal to 2"d or not. 

d.operator <=z should return a variable of type bool to indicate whether 1“ 

fraction is smaller than or equal to 2"d or not. 




Testing: 


vi. Overloaded equality operators for RationalNumber class 

a.operator==: should return a variable of type bool to indicate whether 1“ 

fraction is equal to the 2"d fraction or not. 

b.0peratorl=: should a true value if both the fractions are not equal and return a 

false if both are equal. 


a) Compare and contrast systems programming in Windows as against systems programming in Unix/Linux.


b) Explain the term structured exception handling (SEH) as used in systems programming and give a practical example of how it can be used to handle errors in a block of code.


c) Write a C/C++ system program to delete an unwanted file in the Windows file system. Compile and run the program and copy the source code into your answer booklet. 


a) Discuss the key functions of an operating system, and how these functions make it possible for computer applications to effectively utilize computer system resources.


b) Compare and contrast the Windows API and the POSIX API and briefly explain how these APIs can be applied in systems programming.


c) Write a C/C++ program to create a file in a specified folder of the Windows file system, and write some text to the file. Compile and run the program and copy the source code into your answer booklet.


LATEST TUTORIALS
APPROVED BY CLIENTS