×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Solar Power Panel using C++ Assignment Solution

June 13, 2024
Dr. Sarah Nguyen
Dr. Sarah
🇺🇸 United States
C++
Dr. Sarah Nguyen holds a Ph.D. in Computer Science from the University of Colorado Boulder, USA. With over 7 years of experience, she is a seasoned expert in C++ programming. Having completed over 700 C++ assignments, Dr. Nguyen brings a wealth of knowledge and expertise to every project she undertakes.
Key Topics
  • Solar Panel Installation
Tip of the day
Focus on understanding TensorFlow's computational graph and its eager execution mode. Use pre-built functions like tf.data for efficient data pipelines.
News
The latest version of Google's machine learning library, offering improved performance, streamlined APIs, and expanded support for reinforcement learning, making it a powerful tool for AI development.

Solar Panel Installation

Description:

To write a C++ assignment, where you will develop a program that calculates the cost to replace all generators and solar panels for an energy business. Customers paying cash get a ten percent discount applied to the total cost of generators and solar panels. Customers financing the purchase incur a fifteen percent finance charge based on the total cost of the generator and solar panels. Generators cost $7500.00 each, and solar panels cost $500.00 each. The tax is 7.5% (.075).

Hints:

The total cost of equipment = cost per generator * number of generators purchased + cost per string trimmer * number of string trimmers purchased

Calculate the cost of paying cash or financing Calculate the tax

The average price per energy equipment = Total cost divided by the number of energy equipment purchased Use getline to get strings and cin to get numbers. See example below

Solar 1 (1)
Solar 2 (1)
Solar 3 (1)

Sample Output

Solution:

#include< iostream> #include< string> #include< iomanip> using namespace std; int main() { double solarPanelPrice = 500.00; double generatorPrice = 7500.00; double salesTaxRate = 0.075; double financeCharge = 0.15; double discountPer = 0.10; int numSolarPanelPurchase; int numGeneratorPurchase; string companyName; double subtotal, tax, fee, discount, avgPriceWithCash, avgPriceWithFinance; double totalCostSolarPanels, totalCostGenerators, tempTotal, total; cout << "\n" << fixed << setprecision(2); cout << "\n" << "Enter the name of the company "; getline(cin, companyName); cout << "\n" << "Enter the number of generators to purchase "; cin >> numGeneratorPurchase; cout << "\n" << "Enter the number of solar panels to purchase "; cin >> numSolarPanelPurchase; totalCostGenerators = generatorPrice * numGeneratorPurchase; totalCostSolarPanels = numSolarPanelPurchase * solarPanelPrice; subtotal = totalCostSolarPanels + totalCostGenerators; discount = subtotal * discountPer; fee = subtotal * financeCharge; cout << "\n" << "Invoice for " << companyName << "\n" << "\n"; cout << "Cost for " << numGeneratorPurchase << " generators is $" << totalCostGenerators << "\n"; cout << "Cost for " << numSolarPanelPurchase << " solar panels is $" << totalCostSolarPanels << "\n"; tempTotal = subtotal - discount; cout << "\n" << "If paying cash for the purchase" << "\n"; cout << "The subtotal is $" << tempTotal << "\n"; cout << "The discount is $" << discount << "\n"; tax = tempTotal * salesTaxRate; total = tempTotal + tax; cout << "Tax is $" << tax << "\n"; cout << "The total bill is $" << total << "\n"; avgPriceWithCash = total / (numSolarPanelPurchase + static_cast (numGeneratorPurchase)); cout << "The average cost of the equipment is $" << avgPriceWithCash << "\n" << "\n"; tempTotal = subtotal + fee; cout << "\n" << "If financing the purchase" << "\n"; cout << "The subtotal is $" << tempTotal << "\n"; cout << "The discount is $" << fee << "\n"; tax = tempTotal * salesTaxRate; total = tempTotal + tax; cout << "Tax is $" << tax << "\n"; cout << "The total bill is $" << total << "\n"; avgPriceWithFinance = total / (numSolarPanelPurchase + static_cast (numGeneratorPurchase)); cout << "The average cost of the equipment is $" << avgPriceWithFinance << "\n" << "\n"; cout << "By paying cash you would save $" << (avgPriceWithFinance - avgPriceWithCash) << " per piece of equipment" << "\n" << "\n"; return 0; }

Similar Samples

Discover our range of programming homework samples to see our high standards in action. Each example highlights our problem-solving skills and proficiency across various programming languages. Use these samples to understand how we can help you achieve success in your programming assignments.