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
natima [27]
2 years ago
11

Given two int variables , firstplacewinner and secondplacewinner, write some code that swaps their values . declare any addition

al variables as necessary.
Computers and Technology
1 answer:
Mekhanik [1.2K]2 years ago
5 0
Int tmp;
tmp = firstplacewinner;
firstplacewinner = secondplacewinner;
secondplacewinner = tmp;
You might be interested in
In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
Alex73 [517]

Answer:

See explaination

Explanation:

#include <iostream>

#include <string.h>

using namespace st d;

class Package

{

protected:

//sender properities

char sname[10],saddress[50],scity[20],sstate[20];

long int szip;

//Receiver properities

char rname[10],raddress[50],rcity[20],rstate[20];

long int rzip;

//additonal datamembers

float weight,cost;

public:

Package() //Default constructor

{

strcpy(sname,"");strcpy(saddress,"");strcpy(scity,"");

strcpy(sstate,"");szip=0;

strcpy(rname,"");strcpy(raddress,"");strcpy(rcity,"");

strcpy(rstate,"");rzip=0;

weight=cost=0;

}

Package(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c) //Constructor with parameter

{

strcpy(sname,sn);strcpy(saddress,sa);strcpy(scity,sc); //copying each parameter value to data member

strcpy(sstate,ss);szip=0;

strcpy(rname,rn);strcpy(raddress,ra);strcpy(rcity,rc);

strcpy(rstate,rs);rzip=0;

weight=w;cost=c;

}

float calculateCost() //calculating cost

{

return weight*cost;

}

};

class TwoDayPackage:public Package //Inheritance

{

float flatfee;

public:

TwoDayPackage(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c,float ff) //Constructor with parameter

{

Package(sn,sa,sc,ss,sz,rn,ra,rc,rs,rz,w,c); //calling super class constructor

flatfee=ff; //copy last parameter

}

float calculateCost() //redefined calculateCost function

{

return (weight*cost)+flatfee; //return total cost

}

};

class OverNightPackage:public Package //Inheritance

{

float addfee;

public:

OverNightPackage(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c,float a f) //constructor with parameter

{

Package(sn,sa,sc,ss,sz,rn,ra,rc,rs,rz,w,c); //calling super class constructor

addfee=a f; //copy last parameter

}

float calculateCost() //redefined calculateCost function

{

return (weight*cost)+addfee; //calculating total cost

}

};

int main()

{

Package package1("lou brown","1 main st","boston","ma",11111,"mary smith","7 elm st","new york","ny",22222,8.5,0.5); //creating objects

TwoDayPackage package2("lisa klein", "5 broadway", "somerville", "ma", 33333, "bob george", "21 pine rd", "cambridge", "ma", 44444, 10.5, .65, 2.0 );

OverNightPackage package3 ("ed lewis", "2 oak st", "boston", "ma", 55555, "don kelly", "9 main st", "denver", "co", 66666, 12.25, .7, .25 );

cout<<"\nPackage Cost : "<<package1.calculateCost(); //calling each cost

cout<<"\nTwoDay Package Cost : "<<package2.calculateCost();

cout<<"\nOvernight Package Cost : "<<package3.calculateCost();

return 0;

}

8 0
3 years ago
Declare a structure with a type name: Car containing:
OLga [1]

Answer:

C++ code is given below

Explanation:

#include <iostream>

#include <cctype>

#include <string.h>

#include <cstring>

#include <sstream>

using namespace std;

struct Car {

public:    

char reportingMark[5];    

int carNumber;

string kind;

bool loaded;

string destination;

};

void input(Car *);

void output(Car *);

int main() {

Car *T = new Car;    

input(T);

output(T);    

delete T;    

return 0;

}

void input(Car *T)

{

string str, s;

cout << " Enter the reporting mark as a 5 or less character uppercase string: ";

cin >> str;

for (int i = 0; i < str.length(); i++)

T->reportingMark[i] = toupper(str[i]);

cout << " Enter the car number: ";

cin >> T->carNumber;

cout << " Enter the kind: ";

cin >> T->kind;

cout << " Enter the loaded status as true or false: ";

cin >> s;    

istringstream(s) >> boolalpha >> T->loaded;    

if (T->loaded == true) {

cout << " Enter the destination: ";

cin.ignore();

getline(cin, T->destination);

}

else

T->destination = "NONE";    

}

void output(Car *T)

{

cout << " Reporting Mark: " << T->reportingMark;

cout << " Car Number: " << T->carNumber;    

cout << " Kind: " << T->kind;

cout << " Loaded Status: " << boolalpha << T->loaded;

cout << " Destination: " << T->destination << " ";

}

7 0
3 years ago
Help me please and thanks
Yuri [45]

Answer:

b

Explanation:

6 0
3 years ago
For the block of 400 addresses, what is the length of the net id? njit
rewona [7]
23 bits would leave room for 512 node numbers.
3 0
3 years ago
The following method is intended to remove all values from the ArrayList a that have the same value as val; however, this method
Alona [7]

Answer:

ArrayList a contains [2, 3, 3, 3, 4, 5, 3, 2, 1]

Explanation:

Given

The removeValue method

Required

The content of ArrayList a, after the method is called

From the question, we understand that arraylist a is:

a= [2, 3, 4, 3, 3, 4, 4, 5, 4, 3, 2, 1]

val =4

The function fails when the value to be removed appear consecutively in the list.

4 appears in index 5 and 6 of the list. Only one of the 4's will be removed

So, the updated list will be: [2, 3, 3, 3, 4, 5, 3, 2, 1]

6 0
2 years ago
Other questions:
  • Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What should Sherri
    11·1 answer
  • Which of the following explains the growing need for a standard IT professional licensing program? Check all of the boxes that a
    11·1 answer
  • Advantages of heading attributes
    5·1 answer
  • Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video a
    9·1 answer
  • Please Help meeeeeeeeeee:
    11·2 answers
  • How can I make [ print(3 * x) ] into a functional python code?
    8·1 answer
  • Microsoft Access is a
    10·1 answer
  • GIVING BRAINLIEST
    15·1 answer
  • What is the most used gaming keyboard in 2022?
    8·1 answer
  • There is a group of 10 people who are ordering pizza. If each person gets 2 slices and each pizza has 5 slices, how many pizzas
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!