How could I execute step 2. My variables are budget, total1 for collection1 tota
ID: 3747635 • Letter: H
Question
How could I execute step 2. My variables are budget, total1 for collection1 total2 for collection 2 total3 for collection3. I need to use if, else if, or else statements c programming How could I execute step 2. My variables are budget, total1 for collection1 total2 for collection 2 total3 for collection3. I need to use if, else if, or else statements c programming l T-Mobile Wi-Fi 1:56 PM a instructure-uploads.s3.amazonaws.co C cal Due Thursday, 9/20/2018, 11:59 pm Project Goals The goals of this project an o Ge Hadests amar with f else ments collection 1: to Enter velune, price:Yoar assigmnt will be auoe and any chang Points will be Problem 1 of velamses and po The If the condition is truc (adget is r than ) th progra oeld print: (1) Bob has sone noney to buy collecttons nald print 1) Bob does hat have noney to buy nything II the condition is tre th peogram shouild prist (2) At Least tve collectiens are nore expensive thn Bb's badget shoald print 2) At teast two collecttons are cheaper than or equal to Bob"s budgetExplanation / Answer
Please find the required C program in bold,Let me know if you have any concerns.
#include <stdio.h>
#include<conio.h>
int main()
{
// Geting the user input for fisrt collection
printf("Please enter the number of volumes in first collection ");
int volumeOfCollection1;
scanf("%d",&volumeOfCollection1);
printf("Please enter the price of each volumes in firt collection ");
int priceofEachVolume1;
scanf("%d",&priceofEachVolume1);
int total1= volumeOfCollection1 * priceofEachVolume1; // Calculating 1st collection total price.
// Geting the user input for second collection
printf("Please enter the number volumes in second collection ");
int volumeOfCollection2;
scanf("%d",&volumeOfCollection2);
printf("Please enter the price of each volumes in second collection ");
int priceofEachVolume2;
scanf("%d",&priceofEachVolume2);
int total2= volumeOfCollection2 * priceofEachVolume2;// Calculating 2nd collection total price.
// Geting the user input for second collection
printf("Please enter the number volumes in third collection ");
int volumeOfCollection3;
scanf("%d",&volumeOfCollection3);
printf("Please enter the price of each volumes in third collection ");
int priceofEachVolume3;
scanf("%d",&priceofEachVolume3);
int total3= volumeOfCollection3 * priceofEachVolume3;// Calculating 3rd collection total price.
print("Please enter Bob's Budjet");
int budjet;
scanf("%d",&budjet);
//Step 1:Bob has money to buy some collection.
if(budjet>0)
printf("Bob has money to buy some collections. ");
else
printf("Bob does not have money to buy anything. ");
//Step 2:At least two collections are more expensive than Bob's budjet
// If at least two combinations are more expensive than Bobs budjet then,
// (total1>budjet and total2>0) Or (total2>budjet and total3>0) or (total3>budjet and total1>0)
//Or (total1>budjet and total2> budjet and total3> budjet)
//if at least two collections are more expensive than Bob budjet then.
if((total1>budjet&&total2>budjet)||(total2>budjet&&total3>budjet)||(total1>budjet&&total3>budjet)|| (total1>budjet&&total2>budjet&&total3>budjet)){
printf("At least two collections are more expensive than Bob's budjet ");
} else
{
printf("At least two collections are cheaper or equal to than Bob's budjet ");
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.