Answered Essay: C Programming- Three Fun Programs

C Programming- Three Fun Programs

#include <stdio.h> ONLY PLEASE

Write a program for a furniture company that determines the price of a table. Write a void function displayHeader() that displays the name of the company (CodeVan’s Furniture Store) and present the menu for pine, oak, or mahogany. In main, ask the user to choose 1 for pine, 2 for oak, or 3 for mahogany and ask them to enter ‘a’ for a small table, or ‘b’ for a large table. Pass these two values to a function called cost() that outputs the name of the wood chosen as well as the price of the table. Pine tables cost $100, Oak tables cost $225, and Mahogany tables cost $310.00. Add $65 to the cost for a large table. If the user enters an invalid option, print an error message and reprompt them to enter a correct choice. Call this program A6_1.

Write a program that counts by five from 5 through 200 inclusive, and that starts a new line after every multiple of 50 (50, 100, 150, and 200). Write this three different times, once with a while loop, once with a do while loop, and once with a for loop. Call this program A6_2.

Write a program where the user tries to guess a number. Generate a random number and the player will guess until they get the right answer. The program should tell them is the guess is too high, too low, or correct. When the user guesses the correct number, print out the count of how many attempts it took. Call this program A6_3.

Expert Answer

 

#include <stdlib.h>

void displayHeader() {

printf(“CodeVan’s Furniture Storen”);

printf(“pine, oak, and mahogany wood are availablen”);

/*and present the menu for pine, oak, or mahogany (what is the meaning of this)

Please add whatever you wanted by writing printf for them

Or may be you can ask me to write by providing what information what does that mean*/

}

void cost(int wood, char size) {

if (wood == 1) {

if (size == ‘a’) {

printf(“You choose pine wood and small size table which will cost $100n”);

}

else {

printf(“You choose pine wood and big size table which will cost $165n”);

}

}

if (wood == 2) {

if (size == ‘a’) {

printf(“You choose oak wood and small size table which will cost $225n”);

}

else {

printf(“You choose oak wood and big size table which will cost $290n”);

}

}

if (wood == 3) {

if (size == ‘a’) {

printf(“You choose mahogany wood and small size table which will cost $310n”);

}

else {

printf(“You choose pine mahogany and big size table which will cost $375n”);

}

}

}

int main() {

int wood;

char size;

while (1) {

printf(“Please enter n”);

printf(“1 for pine n”);

printf(“2 for oak n”);

printf(“3 for mahogany n”);

scanf(“%d”, &wood);

if (wood == 1 || wood == 2 || wood == 3) {

break;

}

else {

printf(“Invalid choice !n”);

}

}

while (1) {

printf(“Please enter n”);

printf(“a for small table n”);

printf(“b for large table n”);

scanf(” %c”, &size);

if (size == ‘a’ || size == ‘b’) {

break;

}

else {

printf(“Invalid choice !n”);

}

}

cost(wood, size);

return 0;

}

//Sample output

/*——————————————————————————————————————————*/

#include <stdlib.h>

int main() {

int count = 5;

while (count != 205) {

printf(“%d “, count);

if (count % 50 == 0) {

printf(“n”);

}

count += 5;

}

printf(“n”);

count = 5;

do

{

printf(“%d “, count);

if (count % 50 == 0) {

printf(“n”);

}

count += 5;

} while (count != 205);

printf(“n”);

for (count = 5; count <= 200; count += 5 )

{

printf(“%d “, count);

if (count % 50 == 0) {

printf(“n”);

}

}

return 0;

}

//sample output

/*——————————————————————————————————————————-*/

#include <time.h>

#include <stdlib.h>

int main(void) {

//seed the random number generator

srand(time(NULL));

/*i tested the program for big number it become very tough to guess so i used the below code

which will generate a random number below 1000*/

int number = rand() % 1000;

/* if you want big number then comment out above code and uncomment below code*/

// int number = rand();

int guess = -10;

int number_of_guesses = 0;

printf(“Enter your guess :”);

while (1) {

scanf(“%d”, &guess);

if (guess == number) {

break;

}

else {

++number_of_guesses; //for tracking count of incorrect answer

if (number < guess) {

printf(“your guess is too high !!n”);

printf(“please try again !!n”);

}

else {

printf(“your guess is too low !!n”);

printf(“please try again !!n”);

}

}

}

printf(“Congratulations, you found it! Number of guesses: %dn”, number_of_guesses);

return 0;

}

//Sample Output

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.