Find and correct logic errors so that program works properly

Assignment Help C/C++ Programming
Reference no: EM131324558

Assignment

• Write the code for each lab assignment.

• Submit the lab in a single zip file in the online course shell. The lab must contain all .cpp files, along with any additional files that may be necessary for your project to run (ex: text files).

• Enter any and all written answers into the online course shell along with the submission of the attached lab assignment.
Please submit each lab assignment with only two files for grading.

a .cpp file of your C++ program design (source code)
a .docx file of its program's successful execution output in Word format.

Each lab assignment will be graded based on the following:

1. The program must compile, execute, produce correct results, and meet all of the specifications in the weekly lab.
Additionally you must:
2. Organize the code for user readability.
3. Organize the code for reusability.
4. Provide documentation with embedded comments for reader understanding.
5. Organize the code for efficiency.

Assignment 1:

During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors.

Find and correct the logic errors so that the program works properly.

//Logic errors.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double cost;
double area;

double bagSize;
cout << fixed << showpoint << setprecision(2);
cout << "Enter the amount of fertilizer, in pounds, "
<< "in one bag: ";
cin >> bagSize;
cout << endl;

cout << "Enter the cost of the " << bagSize
<< " pound fertilizer bag: ";
cin >> cost;
cout << endl;

cout << "Enter the area, in square feet, that can be "
<< "fertilized by ne bag: ";
cin >> area;
cout << endl;

cout << "The cost of the fertilizer per pound is: tiny_mce_markerquot;
<< bagSize / cost << endl;
cout << "The cost of fertilizing per square foot is: tiny_mce_markerquot;
<< area / cost << endl;

Return 0;

}

Assignment 2:

Linda is starting a new cosmetic and clothing business and would like to make a net profit of approximately 10% after paying all the expenses, which include merchandise cost, store rent, employees' salary, and electricity cost for the store. She would like to know how much the merchandise should be marked up so that after paying all the expenses at the end of the year she gets approximately 10% net profit on the merchandise cost. Note that after marking up the price of an item she would like to put the item on 15% sale. Write a program that prompts Linda to enter the total cost of the merchandise, the salary of the employees (including her own salary), the yearly rent, and the estimated electricity cost. The program then outputs how much the merchandise should be marked up so that Linda gets the desired profit.

Reference no: EM131324558

Questions Cloud

Strategies of investor-owned hospitals : What does that imply as to the strategies of investor-owned hospitals in managing risk and ensuring adequate capital relative to not-for-profit entities?
Explain the role of the nervous system : Explain the role of the nervous system.Describe the effect of fear, aggression, or anxiety on the specified behavior.Explain the function of the hormones involved and how they relate to the behavior.
Calculate the option price : Consider an American call option on a stock. The stock price is $70, the time to maturity is eight months, the risk-free rate of interest is 10% per annum, the exercise price is $65, and the volatility is 32%. A dividend of $1 is expected after three..
Ductus arteriosus and the ductus venosus : 1) The ductus arteriosus and the ductus venosus are two key vessels in the fetal circulation that are absent in the adult circulation. What are their function in the fetus? Why are they necessary?
Find and correct logic errors so that program works properly : CIS242: During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. Find and correct the logic errors so that the program works properly.
Special features of the lung : 1) Starting with the umbilical vein, list/chart the general flow of blood through the fetus of a pig. 2) What special features of the lung make it a useful organ for gas exchange?
What is the incidence of the subsidy on buyers : In early 2010, the U.S. government offered an $8,000 subsidy to new homebuyers. What effect does a perhouse subsidy have on the equilibrium price and quantity of the housing market? What is the incidence of the subsidy on buyers? Hint: A subsidy i..
Decide to make equal contributions at beginning of year : Ross Clark wishes to endow a chair in finance at his alma mater. The university indicated that it requires $200,000 per year to support the chair, and the endowment would earn 10% per year. Rather than making contributions to an IRA at the end of eac..
Prepare a presentation on human reproduction : You will develop a PowerPoint Presentation about human reproduction. You are to pretend that the presentation is what you will use to give your son or daughter "the talk" about human reproduction. Make sure you use correct terminology. If you have..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd