15.10.2022

Please help me with this #7

. 0

Faq

Computers and Technology
Step-by-step answer
P Answered by Specialist

#include <stdlib.h>

#include <stdio.h>

void func1(int product[]){

int orders[6]={0};

for(int i=0;i<70;i++){

orders[product[i]]++;

}

printf("Total number of each type of products that were bought\n");

for(int i=1;i<=5;i++){

printf("Product %d = %d\n",i,orders[i]);

}

}

void func2(int product[],int quantity[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

total_cost+= price[product[i]]* quantity[i];

}

printf("The total cost of all 70 orders = %.2f\n",total_cost);

}

void func3(int product[],int quantity[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(destination[i]==8){

total_cost+= price[product[i]]* quantity[i];

}

}

printf("The total cost of all products shipped to destination 8 = %.2f\n",total_cost);

}

void func4(int product[],int quantity[],float price[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(price[product[i]]* quantity[i]>=50){

total_orders++;

}

}

printf("The total number of orders where each order is $50 or more = %d\n",total_orders);

}

void func5(int product[],int quantity[],int origination[],float price[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && price[product[i]]* quantity[i]>=50){

total_orders++;

}

}

printf("The total number of orders that originated from 3 where each order is $50 or more. = %d\n",total_orders);

}

void func6(int product[],int quantity[],int origination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && price[product[i]] * quantity[i]>=50){

total_cost += price[product[i]] * quantity[i];

}

}

printf("The total number of orders that originated from 3 where each order is $50 or more. = %.2f\n",total_cost);

}

void func7(int origination[],int destination[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && destination[i]==8){

total_orders++;

}

}

printf("The total number of orders that originated from 3 and shipped to 8. = %d\n",total_orders);

}

void func8(int product[],int quantity[],int origination[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && destination[i]==8){

total_cost += price[product[i]] * quantity[i];

}

}

printf("The total cost of orders that originated from 3 and shipped to 8. = %.2f\n",total_cost);

}

void func9(int destination[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(destination[i]!=8){

total_orders++;

}

}

printf("The total number of orders that was shipped to all destinations except to 8. = %d\n",total_orders);

}

void func10(int product[],int quantity[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(destination[i]!=8){

total_cost += price[product[i]] * quantity[i];;

}

}

printf("The total cost of orders that was shipped to all destinations except to 8. = %.2f\n",total_cost);

}

int main(){

int product[70] = {4, 2, 4, 2, 4, 5, 5, 2, 2, 5, 5, 4, 3, 5, 4, 2, 5, 3, 1, 2, 2, 3, 3, 4, 5, 5, 4, 5, 3, 5, 5, 1, 4, 5, 1, 5, 3, 2, 4, 1, 2, 4, 5, 1, 5, 5, 5, 5, 5, 2, 5, 1, 4, 4, 4, 2, 3, 3, 3, 3, 4, 3, 5, 5, 3, 2, 3, 5, 3, 2};

int quantity[70] = {10, 9, 6, 4, 10, 4, 9, 6, 10, 7, 3, 4, 4, 9, 1, 8, 9, 1, 5, 8, 7, 2, 3, 4, 10, 5, 6, 2, 1, 7, 2, 8, 6, 9, 8, 8, 7, 7, 9, 10, 6, 7, 8, 2, 1, 7, 6, 3, 3, 1, 8, 4, 10, 7, 1, 10, 6, 9, 8, 2, 4, 6, 1, 8, 2, 6, 10, 2, 6, 2};

int origination[70] = {2, 7, 5, 5, 7, 2, 7, 2, 7, 7, 5, 2, 5, 5, 5, 2, 2, 7, 2, 7, 7, 2, 2, 2, 2, 5, 7, 5, 7, 7, 5, 5, 2, 2, 5, 7, 2, 5, 7, 2, 5, 7, 2, 5, 7, 2, 2, 7, 2, 7, 5, 2, 2, 2, 5, 7, 2, 5, 5, 5, 7, 7, 2, 5, 2, 7, 5, 2, 5, 7};

int destination[70] = {8, 7, 3, 10, 2, 6, 4, 5, 1, 3, 5, 9, 5, 8, 6, 4, 3, 7, 1, 2, 7, 2, 8, 2, 2, 1, 2, 6, 10, 2, 7, 7, 8, 6, 8, 8, 4, 8, 3, 10, 6, 9, 4, 9, 5, 1, 7, 3, 1, 7, 5, 5, 4, 9, 3, 10, 8, 1, 1, 1, 1, 8, 10, 3, 5, 2, 8, 7, 4, 10};

float price[6]={0,11.95,7.95,19.95,24.95,15.25};

func1(product);

func2(product,quantity,price);

func3(product,quantity,destination,price);

func4(product,quantity,price);

func5(product,quantity,origination,price);

func6(product,quantity,origination,price);

func7(origination,destination);

func8(product,quantity,origination,destination,price);

func9(destination);

func10(product,quantity,destination,price);

}

Explanation:

The program inputs order, products and cities products are shipped.

After a series of conditional requirements being met, will output the destination each product os going to and the number of products with its associated price.

Computers and Technology
Step-by-step answer
P Answered by Specialist

#include <stdlib.h>

#include <stdio.h>

void func1(int product[]){

int orders[6]={0};

for(int i=0;i<70;i++){

orders[product[i]]++;

}

printf("Total number of each type of products that were bought\n");

for(int i=1;i<=5;i++){

printf("Product %d = %d\n",i,orders[i]);

}

}

void func2(int product[],int quantity[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

total_cost+= price[product[i]]* quantity[i];

}

printf("The total cost of all 70 orders = %.2f\n",total_cost);

}

void func3(int product[],int quantity[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(destination[i]==8){

total_cost+= price[product[i]]* quantity[i];

}

}

printf("The total cost of all products shipped to destination 8 = %.2f\n",total_cost);

}

void func4(int product[],int quantity[],float price[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(price[product[i]]* quantity[i]>=50){

total_orders++;

}

}

printf("The total number of orders where each order is $50 or more = %d\n",total_orders);

}

void func5(int product[],int quantity[],int origination[],float price[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && price[product[i]]* quantity[i]>=50){

total_orders++;

}

}

printf("The total number of orders that originated from 3 where each order is $50 or more. = %d\n",total_orders);

}

void func6(int product[],int quantity[],int origination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && price[product[i]] * quantity[i]>=50){

total_cost += price[product[i]] * quantity[i];

}

}

printf("The total number of orders that originated from 3 where each order is $50 or more. = %.2f\n",total_cost);

}

void func7(int origination[],int destination[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && destination[i]==8){

total_orders++;

}

}

printf("The total number of orders that originated from 3 and shipped to 8. = %d\n",total_orders);

}

void func8(int product[],int quantity[],int origination[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(origination[i]==3 && destination[i]==8){

total_cost += price[product[i]] * quantity[i];

}

}

printf("The total cost of orders that originated from 3 and shipped to 8. = %.2f\n",total_cost);

}

void func9(int destination[]){

int total_orders=0;

for(int i=0;i<70;i++){

if(destination[i]!=8){

total_orders++;

}

}

printf("The total number of orders that was shipped to all destinations except to 8. = %d\n",total_orders);

}

void func10(int product[],int quantity[],int destination[],float price[]){

float total_cost=0;

for(int i=0;i<70;i++){

if(destination[i]!=8){

total_cost += price[product[i]] * quantity[i];;

}

}

printf("The total cost of orders that was shipped to all destinations except to 8. = %.2f\n",total_cost);

}

int main(){

int product[70] = {4, 2, 4, 2, 4, 5, 5, 2, 2, 5, 5, 4, 3, 5, 4, 2, 5, 3, 1, 2, 2, 3, 3, 4, 5, 5, 4, 5, 3, 5, 5, 1, 4, 5, 1, 5, 3, 2, 4, 1, 2, 4, 5, 1, 5, 5, 5, 5, 5, 2, 5, 1, 4, 4, 4, 2, 3, 3, 3, 3, 4, 3, 5, 5, 3, 2, 3, 5, 3, 2};

int quantity[70] = {10, 9, 6, 4, 10, 4, 9, 6, 10, 7, 3, 4, 4, 9, 1, 8, 9, 1, 5, 8, 7, 2, 3, 4, 10, 5, 6, 2, 1, 7, 2, 8, 6, 9, 8, 8, 7, 7, 9, 10, 6, 7, 8, 2, 1, 7, 6, 3, 3, 1, 8, 4, 10, 7, 1, 10, 6, 9, 8, 2, 4, 6, 1, 8, 2, 6, 10, 2, 6, 2};

int origination[70] = {2, 7, 5, 5, 7, 2, 7, 2, 7, 7, 5, 2, 5, 5, 5, 2, 2, 7, 2, 7, 7, 2, 2, 2, 2, 5, 7, 5, 7, 7, 5, 5, 2, 2, 5, 7, 2, 5, 7, 2, 5, 7, 2, 5, 7, 2, 2, 7, 2, 7, 5, 2, 2, 2, 5, 7, 2, 5, 5, 5, 7, 7, 2, 5, 2, 7, 5, 2, 5, 7};

int destination[70] = {8, 7, 3, 10, 2, 6, 4, 5, 1, 3, 5, 9, 5, 8, 6, 4, 3, 7, 1, 2, 7, 2, 8, 2, 2, 1, 2, 6, 10, 2, 7, 7, 8, 6, 8, 8, 4, 8, 3, 10, 6, 9, 4, 9, 5, 1, 7, 3, 1, 7, 5, 5, 4, 9, 3, 10, 8, 1, 1, 1, 1, 8, 10, 3, 5, 2, 8, 7, 4, 10};

float price[6]={0,11.95,7.95,19.95,24.95,15.25};

func1(product);

func2(product,quantity,price);

func3(product,quantity,destination,price);

func4(product,quantity,price);

func5(product,quantity,origination,price);

func6(product,quantity,origination,price);

func7(origination,destination);

func8(product,quantity,origination,destination,price);

func9(destination);

func10(product,quantity,destination,price);

}

Explanation:

The program inputs order, products and cities products are shipped.

After a series of conditional requirements being met, will output the destination each product os going to and the number of products with its associated price.

StudenGPT
Step-by-step answer
P Answered by Studen AI
First, let's ensure we interpret the problem correctly. Your task is to simplify the cube root of 7 and check whether it equals a half power of 7. The provided options are the different reduction paths for this calculation. Before moving forward, let's clarify that the statement \(\sqrt[3]{7}=7^{\frac{1}{2}}\) is incorrect. If we simplify both sides: - The cube root of seven, \(\sqrt[3]{7}\), means raising 7 to the power of 1/3, hence \(7^{\frac{1}{3}}\); - And seven raised to the power of one-half, \(7^{\frac{1}{2}}\), is equivalent to the square root of 7. As \(\sqrt[3]{7}\) and \(7^{\frac{1}{2}}\) yield different values, the statement is false. Now let's examine the options provided. Given the mathematical laws for exponentiation, when you raise a power to another power, you multiply the exponents together (a^(m/n))^n means a^n/n*n = a^1 = a. The correct explanation based on given options should be one that simplifies to \(7^{\frac{1}{3}}\) because the question concerns the cube root of 7. Option B is the correct explanation: \(\left(7^{\frac{1}{3}}\right)^{3}=7^{\frac{1}{3}} \cdot 7^{\frac{1}{3}} \cdot 7^{\frac{1}{3}}=7^{\frac{1}{3}+\frac{1}{3}+\frac{1}{3}}=7^{\frac{3}{3}}=7^{1}=7\) This correctly utilizes the laws of exponentiation and follows the principles I've outlined initially. It is still necessary, however, to underline that this calculation does not prove the initial statement correct, but constitues an accurate simplification for the cube root of 7.

Try asking the Studen AI a question.

It will provide an instant answer!

FREE