CAN YOU HELP ME W/ THIS?

1.) I want to create an array to store the total sales for an ice cream store for Monday through Friday. After the array is filled, ask a user to choose a day of the week (Monday = 1, Tuesday = 2, ....) and print out the total sales for that day. Allowing the program to continue running until the user types "No" to the question, "Do you wish to continue?".

2.) a program that stores 10 random integers between 1 and 10 in an array named numbers. and will Print the store value in an array. Then, will print the array backwards! Finally, will count and print the total number of even numbers in the array.

1.) You want to create an array with 7 values (0-6) and fill it in a for loop. Then you can put the user question in a while loop. ie. while(ans!="No") and just pull which part of the array they ask for, but remember to subtract one since the array starts at 0. ie. Monday is 1 but for the array it would be array[0].
You could make a case statement for this if you wanted, or a bunch of if/elseif statements.


2) random number generator in a for loop from 0-9 that fills the array and then just have a for loop count back from 9-0 to print out backwards. can also use the mod operator % to divide by 2 and if there's no remainder add 1 to the total number of even numbers and then print it out after the loop.


I'm not writing the actual code for you, but if you make an attempt at it, I'll help. This is how you go about it though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.