Questions: 1 680

Answers by our Experts: 1 680

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

Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.


Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".

Let's try this out now!


Input

A line containing two integers separated by a space.

777·7

Output

A line containing a string.

Jackpot!

Implement BST and its operations.


.4. • Enter the code

// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);


// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================

void blah2(int *i)
{
    printf("In function: the value of *i is %d\n", *i);
    (*i)++;  // Equivalent to *i = *i + 1;
    printf("In function: the value of *i after increment is %d\n\n", *i);
}


int main(int argc, char *argv[]) {
    int num;
    
    num = 3;
    blah2(&num);
    
    printf("In main(): the value of num is %d\n", num);

    system("pause");
	return 0;
}


• Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code. Also, comment on the difference between passing parameters to a function by reference and by value.





Using loops and condition statements together, Write a program that calculate the cost of energy for energy units restricted between 0 to 500 kWh for an amount less than $6 000.00 for any Zimbabwean resident customer and any amount and unlimited number of units for a foreign resident customer buying from outside Zimbabwe at a rate of $90.00 to one USD. The tariffs are as follows:








• 0 to 50 kWh cost $2.25








• Above 50 kWh to 100 kWh cost $4.51 / kWh








• Above 100kWh to 200 kWh cost $7.89 / kWh








• Above 200kWh to 300 kWh cost $11.25 / kWh








• Above 300kWh to 400 kWh cost $12.94 / kWh








• Above 400 kWh cost $13.50 / kWh

5.3

Enter the code

void blah(int i)
{
    printf("In function: the value of i is %d\n", i);
    i++;
    printf("In function: the value of i after increment is %d\n\n", i);
}


int main(int argc, char *argv[]) {
    int num;
    
    num = 3;
    blah(num);
    
    printf("In main(): the value of num is %d\n", num);

    system("pause");
	return 0;
}


• Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.


1.6) Enter the code

void Hello()
{
    printf("Hello world\n");
}


int main(int argc, char *argv[])
{    
    Hello();

    system("pause");
	return 0;
}


Add the output of this program to your logbook

• You should be able to appreciate that functions can be used to prevent code duplication. Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.


Write a program C that prompts the user to input: 4 quizzes, 4 laboratory exercises and 4 assignments in percentage for Class Participation. Class Participation=(avgQuiz+avgLab+avgAssignments)/3 *40%. The user will input the prelim exam. Percentage of PrelimExam=prelimexam*60%. The program should output the Prelim Grade: Prelim Grade = class participation + percentage of Prelim Exam. Put a remarks: if the grade is greater than or equal to 75 display PASSED, otherwise FAILED

SAMPLE RUN:

Class Participation

Quiz 1: 95

Quiz 2: 75

Quiz 3: 87

Quiz 4: 70

Average: 81.75

Lab. 1: 90

Lab. 2: 85

Lab. 3: 88

Lab 4: 80

Average: 85.75

Assignment 1: 80

Assignment 2: 75

Assignment 3: 86

Assignment 4: 95

Average: 84

Class Participation: 33.53

Prelim Exam: 89

%: 53.4

Prelim Grade: 86.93

Remarks: PASSED


You’re tasked with pairing up people with each other but you need to figure out how well both of them work together. In order to find out how effective each pair is, you need to create a program that adds both of their values and returns their sum.


Input

-1000<= x <= -1000

-1000<= y <= -1000


Two int inputs separated by a space

100·100






Your task is to develop a circular linked-list-based simulation of the Josephus problem. The simulation will be text-based. The user should be presented with a text-based menu asking him to enter the total number of people (n), the starting point (i), direction (clockwise/anti-clockwise), and number to be skipped (k).

Let’s take an example. • For n =15 (i.e. number of people is 15) • k = 2 (i.e. every 2nd person is killed) • starting point (i) = 1 • direction = clockwise

Initial scenario: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

After 1 st iteration: 1 3 5 7 9 11 13 15

After 2nd iteration: 3 7 11 15

After 3rd iteration: 7 15

After 4th iteration: 15 (15 remains in the end). The program stops here.


please give the right as given in the question and also show your output.


LATEST TUTORIALS
APPROVED BY CLIENTS