This is done in c programming and i have the code for the programs that it wants at the bottom i jut dont know how to call the functions
Program 2:Tip,Tax,Total
int main(void)
{
// Constant and Variable Declarations
double costTotal= 0;
double taxTotal = 0;
double totalBill = 0;
double tipPercent = 0;
// *** Your program goes here ***
printf("Enter amount of the bill: $");
scanf("%lf", &costTotal);
printf("\n");
// *** processing ***
taxTotal = 0.07 * costTotal;
totalBill = costTotal + taxTotal;
tipPercent = 0.15 * totalBill;
totalBill = taxTotal + costTotal + tipPercent;
// *** output ***
printf("Based on a bill of $%.2lf, The calculated
amounts are:\n", costTotal);
printf("Tip = $%.2lf\n", tipPercent);
printf("Tax = $%.2lf\n", taxTotal);
printf("Total = $%.2lf\n", totalBill);
printf("\n");
return 0;
} // end main()
Program 3: Minutes,hours,days
int main(void)
{
// Constant and Variable Declarations
int numSeconds = 0;
double numMins = 0.0;
double numHours = 0.0;
double numDays = 0.0;
int const NUMSECMIN = 60;
int const NUMSECHOUR = 3600;
int const NUMSECDAY = 86400;
// *** Your program goes here ***
printf("Enter the number of seconds: ");
scanf("%d", &numSeconds);
printf("\n");
// ***processing***
numMins = numSeconds / NUMSECMIN;
numHours = numSeconds / NUMSECHOUR;
numDays = numSeconds / NUMSECDAY;
if (numSeconds >= 1) {
printf("The number of seconds you
entered, %d, is %.2lf minutes.\n", numSeconds, numMins);
}
else {
printf("The number of seconds
entered must be greater than 0.\n");
}
if (numSeconds >= NUMSECHOUR)
{
printf("The number of seconds you
entered, %d, is %.2lf hours.\n", numSeconds, numHours);
}
if (numSeconds >= NUMSECDAY)
{
printf("The
number of seconds you entered, %d, is %.2lf days.\n", numSeconds,
numDays);
}
printf("\n");
return 0;
} // end main()
Programm 4: Calories Burned
int main(void)
{
// Constant and Variable Declarations
const double CALORIES_MIN = 3.9;
int loopStart = 10;
int loopEnd = 30;
double whileLoop = 19.5;
int loopTwostart = 10;
int loopTwoend = 30;
double doWhileloop = 19.5;
int loopForstart = 10;
int loopForEnd = 30;
double loopFor = 19.5;
// *** Your program goes here ***
printf("You burn 3.90 calories every minute you
run.\n");//printing out the starting prompt no input
printf("This shows how many calories you burn if you
ran for 'x' minutes.\n");
printf("\tMinutes Calories\n");
printf("\t------- --------\n");
printf("Using a while loop\n");
while (loopStart <= loopEnd) {
whileLoop = whileLoop +
19.5;//incrimenting the min loop varaiable
printf("\t %d\t%.2lf\n", loopStart,
whileLoop);
loopStart = loopStart + 5;//
incrimenting the caloires
}
printf("\n");// new line
printf("Using a do-while loop\n");
do {
doWhileloop = doWhileloop +
19.5;//incrimenting the min loop varaiable
printf("\t %d\t%.2lf\n",
loopTwostart, doWhileloop);
loopTwostart = loopTwostart + 5;//
incrimenting the caloires
} while (loopTwostart <= loopTwoend);// this is the
condition
printf("\n");
printf("Using a for loop\n");
for (int i = loopForstart; i <= loopForEnd; i = i +
5) {
loopFor = loopFor + 19.5;
printf("\t %d\t%.2lf\n",
loopForstart, loopFor);
loopForstart = loopForstart +
5;
}
printf("\n");
return 0;
} // end main()
void tip_tax_total()
{
// Constant and Variable Declarations
double costTotal= 0;
double taxTotal = 0;
double totalBill = 0;
double tipPercent = 0;
// *** Your program goes here ***
printf("Enter amount of the bill: $");
scanf("%lf", &costTotal);
printf("\n");
// *** processing ***
taxTotal = 0.07 * costTotal;
totalBill = costTotal + taxTotal;
tipPercent = 0.15 * totalBill;
totalBill = taxTotal + costTotal + tipPercent;
// *** output ***
printf("Based on a bill of $%.2lf, The calculated
amounts are:\n", costTotal);
printf("Tip = $%.2lf\n", tipPercent);
printf("Tax = $%.2lf\n", taxTotal);
printf("Total = $%.2lf\n", totalBill);
printf("\n");
}
void minutes_hours_delays()
{
// Constant and Variable Declarations
int numSeconds = 0;
double numMins = 0.0;
double numHours = 0.0;
double numDays = 0.0;
int const NUMSECMIN = 60;
int const NUMSECHOUR = 3600;
int const NUMSECDAY = 86400;
// *** Your program goes here ***
printf("Enter the number of seconds: ");
scanf("%d", &numSeconds);
printf("\n");
// ***processing***
numMins = numSeconds / NUMSECMIN;
numHours = numSeconds / NUMSECHOUR;
numDays = numSeconds / NUMSECDAY;
if (numSeconds >= 1) {
printf("The number of seconds you
entered, %d, is %.2lf minutes.\n", numSeconds, numMins);
}
else {
printf("The number of seconds
entered must be greater than 0.\n");
}
if (numSeconds >= NUMSECHOUR)
{
printf("The number of seconds you
entered, %d, is %.2lf hours.\n", numSeconds, numHours);
}
if (numSeconds >= NUMSECDAY)
{
printf("The
number of seconds you entered, %d, is %.2lf days.\n", numSeconds,
numDays);
}
printf("\n");
}
void Calories_burned()
{
// Constant and Variable Declarations
const double CALORIES_MIN = 3.9;
int loopStart = 10;
int loopEnd = 30;
double whileLoop = 19.5;
int loopTwostart = 10;
int loopTwoend = 30;
double doWhileloop = 19.5;
int loopForstart = 10;
int loopForEnd = 30;
double loopFor = 19.5;
// *** Your program goes here ***
printf("You burn 3.90 calories every minute you
run.\n");//printing out the starting prompt no input
printf("This shows how many calories you burn if you
ran for 'x' minutes.\n");
printf("\tMinutes Calories\n");
printf("\t------- --------\n");
printf("Using a while loop\n");
while (loopStart <= loopEnd) {
whileLoop = whileLoop +
19.5;//incrimenting the min loop varaiable
printf("\t %d\t%.2lf\n", loopStart,
whileLoop);
loopStart = loopStart + 5;//
incrimenting the caloires
}
printf("\n");// new line
printf("Using a do-while loop\n");
do {
doWhileloop = doWhileloop +
19.5;//incrimenting the min loop varaiable
printf("\t %d\t%.2lf\n",
loopTwostart, doWhileloop);
loopTwostart = loopTwostart + 5;//
incrimenting the caloires
} while (loopTwostart <= loopTwoend);// this is the
condition
printf("\n");
printf("Using a for loop\n");
for (int i = loopForstart; i <= loopForEnd; i = i +
5) {
loopFor = loopFor + 19.5;
printf("\t %d\t%.2lf\n",
loopForstart, loopFor);
loopForstart = loopForstart +
5;
}
printf("\n");
}
so then you can make a common main for all these functions and call these functions as below
int main(){
tip_tax_total();
minutes_hours_delays();
Calories_burned();
return 0;
}
Or you can even provide arguments to the above functions and then pass all the entered by the user and hence call the function alongwith passing those arguments .
This is done in c programming and i have the code for the programs that it wants at the bottom i ...
C++ HELP I need help with this program. I have done and compiled this program in a single file called bill.cpp. It works fine. I am using printf and scanf. Instead of printf and scanf use cin and cout to make the program run. after this please split this program in three files 1. bill.h = contains the class program with methods and variables eg of class file class bill { } 2. bill.cpp = contains the functions from class...
Plz give me correct code and screen shots for this question by using SASM !!!!!!!! Implement the following working C++ program in assembler. Submit assembler code and screen shot. #include <iostream> #include <iomanip> using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A do-while loop // allows the program to repeat until the user selects menu choice 4. int main() { // Constants for membership rates const...
C++ HELP I need help with this program. I have done and compiled this program in a single file called bill.cpp. It works fine. But I need to split this program in three files 1. bill.h = contains the class program with methods and variables 2. bill.cpp = contains the functions from class file 3. main.cpp = contains the main program. Please split this program into three files and make the program run. I have posted the code here. #include<iostream>...
THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) { return bags * 30.0; } void displayMessage(void) { cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() { double bags = 0; cout << "Enter the amount of checked bags you have." << endl; cout <<...
NEED CODE HELPS WITH C PROGRAMMING. ISSUES EXPLAINED IN BOLD. COMPARING TWO LETTERS AND CALLING A FUNCTION. Problem are explained in bold #include <stdio.h> #include <string.h> #include <stdlib.h> #define pi 3.1415 void Area (double n); void VolSphere (double n); void Circumference (double n); void AllCalc (); // i dont know if the declaration of the function is correct AllCalc = AllCalculations //function main begins program execution int main (void) { puts("-Calculating Circle Circumference, Circle Area or Sphere Volume-\n"); void (*f[4])...
CSC 130 Lab Assignment 8 – Program Menu Create a C source code file named lab8.c that implements the following features. Implement this program in stages using stepwise refinement to ensure that it will compile and run as you go. This makes it much easier to debug and understand. This program presents the user a menu of operations that it can perform. The choices are listed and a prompt waits for the user to select a choice by entering a...
C++ Can someone please help with this code... even when the players number isnt a winning number the program always says the player wins: #include <stdio.h> #include <time.h> //main function int main() { //seeding a random number srand(time(0)); //define the arrays for the wagered, winning amount, percent amount double amounts[7] = { 1, 5, 10, 20, 50, 100, 1000 }; double payoff[7] = { 100, 500, 1000, 2000, 5000, 10000, 100000 }; double percent[7] = { 0.01, 0.05, 1, 2,...
Objectives: - Practice designing/implementing algorithms - Practice use of functions Code and document the following functions using NON-RECURSIVE ITERATION only. Test the functions by calling them from a simple interactive main() function using a menu, with different values used to select the choice of function. Overall, you should have one C program (call it Lab1.c) containing one main() function and 5 other functions, where the functions are called based on an interactive user menu. The program should contain a loop...
Objectives: - Practice designing/implementing algorithms - Practice use of functions Code and document the following functions using NON-RECURSIVE ITERATION only. Test the functions by calling them from a simple interactive main() function using a menu, with different values used to select the choice of function. Overall, you should have one C program (call it Lab1.c) containing one main() function and 5 other functions, where the functions are called based on an interactive user menu. The program should contain a loop...
I'm having trouble understanding pointers in my c programming class. I posted the pointer assignment below. If you could leave comments pointing out where pointers are used it would be much appreciated! ----------------------------------------------------------------------------------------------------------------------------------- Write a complete C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this amount using the least number of bills. The bills dispenses are 50s, 20s, and 10s. Write a...