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
Xelga [282]
2 years ago
9

write a C++ program that ask the user for the number of cookies eaten and display the calorie consumption

Computers and Technology
1 answer:
Artyom0805 [142]2 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   int cookies;

   cin >> cookies;

   cout << "The calorie consumption is: " << cookies * 142 << endl;

   return 0;

}

Explanation:

First line: include basic library of C++(input and output).

using namespace std;

Says to compiler we are using std.

int main() Main function

int cookies, cookies variable, of int type

cin >> cookies

get the number of the cookies from user

cout Print the text and calories(one cookie have 142 calories)

Have a nice day ;)

You might be interested in
Tuesday
4vir4ik [10]

Answer:

?

Explanation:

these are instructions to a question?

7 0
2 years ago
Assume that ip , jp , and tp have all been declared to be pointers to int and that result has been declared to be an array of 10
natita [175]

Answer:

The code to this question can be given as:

code:

tp = ip;

ip = jp;

jp = tp;

Explanation:

In this question, it is defined that write code for swapping values that swap the pointers, not the values they point to. So in this code, we assume that all the variable and its value is defined. we simply use the swapping rule that is the first value holds in the new variable and second value hold on the first variable and in the last second variable holds the value of the new variable. In this code, the value will be interchanged or swapped.

3 0
3 years ago
In Java: Write a class called Shelf that contains instance data that repre-sents the length, breadth, and capacity of the shelf.
disa [49]

Answer:see explanation

Explanation:

Hello, the solution is the following:

in a file named Shelf.java :

public class Shelf{

   int length;

   int breadth;

   int capacity;

   boolean occupied;

   Shelf(int length,int breadth, int capacity){

       this.length = length;

       this.breadth = breadth;

       this.capacity = capacity;

       this.occupied = false;

   }

   

   //set methods

   public void setLength(int length){

       this.length = length;

   }

   public void setBreadth(int breadth){

       this.breadth = breadth;

   }

   public void setCapacity(int capacity){

       this.capacity = capacity;

   }

   public void setOccupied(boolean occupied){

       this.occupied = occupied;

   }

   

   //get methods

   public int getLength(){

       return this.length;

   }

   public int getBreadth(){

       return this.breadth;

   }

   public int getCapacity(){

       return this.capacity;

   }

   public boolean getOccupied(){

       return this.occupied;

   }

   

   //tostring method

   

   public String toString(){//overriding the toString() method  

 return "Shelf: \n"+" length: "+Integer.toString(this.length)+" breadth: "+Integer.toString(this.breadth)+" capacity: "+Integer.toString(this.capacity)+" occupied: "+Boolean.toString(this.occupied);

}  

}

in another file named ShelfCheck.java

public class ShelfCheck {

 public static void main(String[] args) {

   Shelf s1=new Shelf(100,150,300);

   Shelf s2=new Shelf(200,200,234);  

   Shelf s3=new Shelf(300,222,543);  

   Shelf s4=new Shelf(400,434,654);

   System.out.println(s1);

   System.out.println(s2);

   System.out.println(s3);

   System.out.println(s4);

   s4.setLength(5);

   System.out.println(s4);

   s2.setBreadth(2);

   System.out.println(s2);

   s3.setCapacity(1);

   System.out.println(s3);

   s1.setOccupied(true);

   System.out.println(s1);

 }

}

OUTPUT:

Shelf:

length: 100 breadth: 150 capacity: 300 occupied: false

Shelf:

length: 200 breadth: 200 capacity: 234 occupied: false

Shelf:

length: 300 breadth: 222 capacity: 543 occupied: false

Shelf:

length: 400 breadth: 434 capacity: 654 occupied: false

Shelf:

length: 5 breadth: 434 capacity: 654 occupied: false

Shelf:

length: 200 breadth: 2 capacity: 234 occupied: false

Shelf:

length: 300 breadth: 222 capacity: 1 occupied: false

Shelf:

length: 100 breadth: 150 capacity: 300 occupied: true

5 0
2 years ago
An animal shelter recently held an adoption event and found homes for 48 of their shelter animals. If they found home for 80% of
vredina [299]

Answer:

9.6

Explanation:

4 0
3 years ago
Read 2 more answers
Everything is made of tiny Antoms each of these Antoms is made up of a core that has a positive charge and some electrons that c
arlik [135]

Answer:

Magnetism

Explanation:

Magnetism or magnetic energy is a natural phenomenon, we can find magnetism in some materials like nickel, cobalt, and iron, or their alloys are magnets, this was produced the first time in Greece at the city Magnesia del Meandro, for this city is the name magnetism, there were stones that attracted and this was called natural magnetism.

4 0
2 years ago
Other questions:
  • Why ues storage unit?​
    12·1 answer
  • PLEASE HELP
    12·2 answers
  • Trisha is looking for a new table style. What is the fastest way for her to preview how different styles in the gallery would lo
    13·1 answer
  • What is a fax machine used for
    9·1 answer
  • Select a cybersecurity career that interests you. Describe the job duties and identify the skills required to excel in that care
    15·1 answer
  • Which of the following lines of code is syntactically correct?
    14·1 answer
  • Write a method that determines the total number of chars in each string of an array.
    12·1 answer
  • Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, in which a and b a
    11·1 answer
  • __________(fill in the blank) in online education refer(s) to how online education impacts students of a specific economic group
    15·1 answer
  • Any changes done to the software during the operational phase of the software before project wind up is called as maintenance. S
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!