Grocery Store Part 2

Im stuck!

Can anyone share their finished code with me for Grocery Store Part 2?

I’ve tried to work through it with GPT as well but I’m just not getting there. I’d love to be able to see a finished version so that I can understand where i’m going wrong.

Hope it still helps after 19 days. Below is my solution with some of my comments, which you can easily discard. They are just steps in completing the assignment.

#include <stdio.h>

int main() {
  
 int appleQuantity;
 double applePrice = 1.49;
 double appleReview;
 int appleReviewDisplay;
 const char appleLocation = 'F';
 
 //Step3, create new int dayOfWeek and set any value equal/greater than 0:
 int dayOfWeek = 0;
 //Step4, increase the value of dayOfWeek variable:
 dayOfWeek += 17;

 appleQuantity = 23;
 //Step2, calculate appleReview:
 appleReview = 823/9;
 //Step6, modify reviewScore:
 appleReview = (823+52)/10;
 appleReviewDisplay = appleReview;
 //Step1, see if appleQuantity is less than 10:
 //Step5, check if it is the 4th day of the week (tle sem pozabil "% 7" vpisat, da mi vedno preveri, če je četrti dan v tednu)
 if(appleQuantity < 10 || dayOfWeek % 7 == 3)
 {
  printf("Sale on apples today, today only they are: $%.2f\n", applePrice * .9);
 }

 // Put all your code above this and if you declare your variables using the given names and types there is no need to change any of the code below.
 printf("An apple costs: $%.2f, there are %d in inventory found in section: %c and your customers gave it an average review of %d%%!", applePrice, appleQuantity, appleLocation, appleReviewDisplay);

Thank you @markan1783 :slight_smile:

1 Like