1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lbvjy [14]
4 years ago
10

Please code this in c++

Computers and Technology
1 answer:
katrin [286]4 years ago
5 0

Answer:

See explaination

Explanation:

#include<iostream>

#include<fstream>

using namespace std;

int main(){

double price, totalPrice = 0, weight;

string product, filename;

cout<<"Enter filename: ";

cin>>filename;

ifstream fin;

fin.open(filename.c_str());

while(fin>>product>>price){

cout<<"Enter weight for "<<product<<": ";

cin>>weight;

totalPrice+=price*weight;

}

cout<<"\nThe total cost of the purchase: $"<<totalPrice<<endl;

return 0;

}

You might be interested in
Which of the following tasks can you perform using a word processor?
frutty [35]

Answer:

check a document for spelling errors

Explanation:

With a word processor, you can easily edit and make changes to a document, move text around in a document, add images, change fonts, check for spelling errors

3 0
3 years ago
Who invented the Porsche?
horsena [70]

Ferdinand Porsche. Hoped this helped!

3 0
3 years ago
Read 2 more answers
_______ is the process of checking data for validity and completeness
timurjin [86]
Data Editing is the answer
7 0
3 years ago
URGENT HELPP<br> WILL MARK BRAINLIST
Semenov [28]

Answer:

1. (1) Travel guide, (2) Study notes for students , (3) Some creative ideas that I want to share with others

2. (1) he or she would have some work related to the website I have created, (2) he or she would be interested in knowing about something which would be available in my created website

3. I want to learn how to add photos in the html pages

3 0
3 years ago
1. Write a program that asks for 4 separate numbers that are binary (1 or 0). Create a variable called b0 for the first, b1 for
Snowcat [4.5K]

Answer:

import java.util.Scanner;

public class CocaColaVendingTest {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter four sepertate binary numbers (1 or 0)");

       int b0 = in.nextInt();

       int b1 = in.nextInt();

       int b2 = in.nextInt();

       int b3 = in.nextInt();

       System.out.println("This formula \"8b0 4b1 2b2 b3\" is applied to get the following" +

               " "+(8*b0)+", "+(4*b1)+", "+(2*b2)+", "+(b3));

   }

}

Explanation:

This is implemented in java

Using the scanner class, the user is prompted to enter for values (0s or 1s)

These are received and stored in the variables b0, b1,b2,b3 as ints.

The formula  8b0 4b1 2b2 b3 is then applied within the output statement to display the results as required by the question

8 0
3 years ago
Other questions:
  • In the lab, you used the filter box in Wireshark to remove traffic from port 3389. What is that port used for? What filter synta
    12·1 answer
  • Most modern TCP implementations use pseudo-random number generators (PRNG) to determine starting sequence numbers for TCP sessio
    13·1 answer
  • Given that k refers to an int that is non-negative and that plist1 has been defined to be a list with at least k 1 elements, wri
    14·1 answer
  • What does it mean to “declare a variable”? create a variable use a variable share a variable modify a variable
    11·2 answers
  • If you are signed into a Microsoft account and need to sign into another one, click ____ on the list arrow next to Your Name in
    8·1 answer
  • On her last performance review, beverly's boss commented that she needs to help out her co-workers when they are busy in order t
    5·2 answers
  • A(n) _____ website gathers, organizes, and then distributes web content.
    10·1 answer
  • Ronaldo wants to determine if employees would prefer having bagels or
    15·1 answer
  • What is the advantage of using a translation look-aside buffer (TLB), also called associative memory, in the logical-physical ad
    15·1 answer
  • How to turn off microsoft teams message notifications
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!