In: Computer Science
What is the expected output from the following program (3 answers)
______ ______namespace std; double insurance(int); void main() { int j; ______ mileage; ______ monthly_rent; for (j=______ j<4; j++) { mileage=1000*j; monthly_rent= 0.3*mileage + insurance(mileage); printf("Monthly rent for %4d.2f is : $ ______ . \n", mileage, monthly_rent); } } double insurance(int miles) { double mileage_charge; if (miles<=1000) { mileage_charge=100.0; }___ if ((miles>1000) && (miles<=2000)) { mileage_charge=150.0; }; ___ (miles>2000) { mileage_charge=200.0; }; return(mileage_charge);
#include <iostream> using namespace std; double insurance(int); int main() { int j; int mileage; double monthly_rent; for (j=0; j<4; j++) { mileage=1000*j; monthly_rent= 0.3*mileage + insurance(mileage); printf("Monthly rent for %4d.2f is : $ %lf . \n", mileage, monthly_rent); } return 0; } double insurance(int miles) { double mileage_charge; if (miles<=1000) { mileage_charge=100.0; } else if ((miles>1000) && (miles<=2000)) { mileage_charge=150.0; } else if (miles>2000) { mileage_charge=200.0; } return(mileage_charge); }