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
Ierofanga [76]
3 years ago
13

Computer programming 3

Computers and Technology
1 answer:
AfilCa [17]3 years ago
5 0
The first photo of output i still need 2 posts

You might be interested in
30.1 LAB*: Warm up: Online shopping cart (Part 1) (1) Create three files to submit: ItemToPurchase.h - Class declaration ItemToP
nlexa [21]

Answer:

see explaination

Explanation:

#ifndef ITEMTOPURCHASE_H

#define ITEMTOPURCHASE_H

#include<iostream>

using namespace std;

class ItemToPurchase

{

public:

ItemToPurchase();

void setItemName(string name);

void setItemPrice(int itemPrice);

void setItemQuantity(int itemQuantity);

string getItemName();

int getItemPrice();

int getItemQuantity();

virtual ~ItemToPurchase();

protected:

private:

string itemName ;

int itemPrice;

int itemQuantity ;

};

#endif // ITEMTOPURCHASE_H

#include "ItemToPurchase.h"

ItemToPurchase::ItemToPurchase()

{

//ctor

this->itemName="none";

this->itemPrice=0;

this->itemQuantity=0;

}

void ItemToPurchase::setItemName(string name)

{

this->itemName=name;

}

void ItemToPurchase::setItemPrice(int itemPrice)

{

this->itemPrice=itemPrice;

}

void ItemToPurchase::setItemQuantity(int itemQuantity)

{

this->itemQuantity=itemQuantity;

}

string ItemToPurchase::getItemName()

{

return itemName;

}

int ItemToPurchase::getItemPrice()

{

return itemPrice;

}

int ItemToPurchase::getItemQuantity()

{

return itemQuantity;

}

ItemToPurchase::~ItemToPurchase()

{

//dtor

}

#include <iostream>

#include "ItemToPurchase.h"

using namespace std;

int main()

{

ItemToPurchase item1,item2;

string itemName ;

int itemPrice;

int itemQuantity ;

int totalCost=0;

cout<<"Item 1:"<<endl;

cout<<"Enter the item name : ";

getline(cin,itemName);

//cin.ignore();

cout<<"Enter the item price : ";

cin>>itemPrice;

cout<<"Enter the item quantity : ";

cin>>itemQuantity;

item1.setItemName(itemName);

item1.setItemPrice(itemPrice);

item1.setItemQuantity(itemQuantity);

cin.ignore();

cout<<"Item 2:"<<endl;

cout<<"Enter the item name : ";

getline(cin,itemName);

//cin.ignore();

cout<<"Enter the item price : ";

cin>>itemPrice;

cout<<"Enter the item quantity : ";

cin>>itemQuantity;

item2.setItemName(itemName);

item2.setItemPrice(itemPrice);

item2.setItemQuantity(itemQuantity);

cout<<"TOTAL COST : "<<endl;

cout<<item1.getItemName()<<" "<<item1.getItemQuantity()<<" at $"<<item1.getItemPrice()<<" = "<<(item1.getItemQuantity()*item1.getItemPrice())<<endl;

cout<<item2.getItemName()<<" "<<item2.getItemQuantity()<<" at $"<<item2.getItemPrice()<<" = "<<(item2.getItemQuantity()*item2.getItemPrice())<<endl;

totalCost=(item1.getItemQuantity()*item1.getItemPrice())+(item2.getItemQuantity()*item2.getItemPrice());

cout<<"Total : $"<<totalCost<<endl;

return 0;

}

Note: Replace at with the at symbol

See attachment for output

3 0
3 years ago
(display five messages) write a program that displays welcome to java five times.
Nitella [24]
<span>/** * * * Exercise 1.2 - Display Five Messages * */ public class Ex01_02 { public static void main(String[] args) { System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); System.out.println("Welcome to Java"); } }</span>
4 0
3 years ago
Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the secon
Alja [10]

Answer:

// Assume that all variables a, n, temp have been declared.

 // Where a is the array, n is the array length, temp is a temporary

 // storage location.

 // Cycle through the array a.

 // By the time the loop gets halfway,

 // The array would have been reversed.

 // The loop needs not get to the end of the array.

 // Hence, the loop ends halfway into the array i.e n/2.

 for (int k = 0; k < n / 2; k++) {

   

  // Swap first and last, second and next-to-the-last and so on

  temp = a[k];

  a[k] = a[n - k - 1];

  a[n - k - 1] = temp;

 }

Explanation:

Explanation has been given in the code in form of comments. Please go through the comments in the code carefully.

Hope this helps!

6 0
3 years ago
From the computer desktop, clicking the Start button lets you _____.
stepan [7]
Locate and open Excel
8 0
3 years ago
Read 2 more answers
The four levels of administration necessary to keep human services organization operating smoothly.
noname [10]
The four levels of administration that is necessary to keep human services organization run smoothly are; 1. Top management, 2. Middle management, 3. Lower management,4. Operational management.
3 0
3 years ago
Other questions:
  • If the polar bear were taken out of the food chain what would happen to the seal population
    10·1 answer
  • A pair is a simple struct with two data members, one of type T1 and one of type T2. A set and a map are organized as binary sear
    10·1 answer
  • In an IPv.4 addressing scheme the router works at layer 3 on which addressing layer?
    14·1 answer
  • A(n) ___________________ process is initiated by individuals who are subjected to forensic techniques with the intention of hidi
    6·1 answer
  • While working with style formatting for a Microsoft Word document, when you change the text or paragraph formatting of a single
    13·1 answer
  • What is the relationship between data, information, business intelligence, and knowledge?
    10·1 answer
  • Write a program that takes a point (x,y) from theuser and find where does the point lies. The pointcan
    8·1 answer
  • What is VLSI stand for​
    14·1 answer
  • FREE POINTS FIRST TO ANSWER GETS BRANLIEST!!! :)
    11·2 answers
  • Assume three jobs arrive at approximately the same time (arrival time are all 0), but Job A arrives slightly before Job B, and J
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!