HW06
.pdf
keyboard_arrow_up
School
Harvard University *
*We aren’t endorsed by this school
Course
2396
Subject
Computer Science
Date
Apr 3, 2024
Type
Pages
7
Uploaded by agentjake7
HW06.py
Test failed: False is not true
dict
str
list
'vanilla'
'Vanilla'
>>> restaurants = { "Cold Stone" : (
"Cookies n Cream"
, "Vanilla"
), "Dairy Queen" : (
"vanilla"
, "chocolate"
, "coffee"
), "Steak n Shake" : (
"Peanut Butter"
,) } >>> flavor = "Vanilla" >>> milkshakes(restaurants, flavor) [
'Cold Stone'
, 'Dairy Queen'
] >>> restaurants = { "Olive Garden" : (
"Vanilla"
,), "McDonalds" : (
"Vanilla-Chocolate Swirl"
, "Double Chocolate"
), "Chick-Fil-A" : (
"Frozen Lemonade"
,) } >>> flavor = "Frozen Lemonade" >>> milkshakes(restaurants, flavor) [
'Chick-Fil-A'
] list
str
dict
"a" < "b" == True >>> words = [
"abracadabra"
, "ambidextrous"
, "amphibian"
, "astronaut"
, "frog"
] >>> letter = "d"
>>> letterCounter(words, letter)
{
'abracadabra'
: 8
, 'ambidextrous'
: 2
, 'amphibian'
: 3
, 'astronaut'
: 2
, 'frog'
: 0
}
>>> words = [
"rainbow"
, "bloom"
, "sunny"
, "moon"
, "trees"
] >>> letter = "p"
>>> letterCounter(words, letter)
{
'rainbow'
: 5
, 'bloom'
: 5
, 'sunny'
: 2
, 'moon'
: 4
, 'trees'
: 2
} list
list
tuple
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
debug
arrow_forward
var adventurersName = ["George", " Tim", " Sarah", " Mike", " Edward"];var adventurersKilled = 3;var survivors;var leader = "Captain Thomas King";var numberOfAdventurers = adventurersName.length;
survivors = numberOfAdventurers - adventurersKilled;
console.log("Welcome to The God Among Us\n");console.log("A group of adventurers began their search for the mystical god said to live among us. In charge of the squad was " + leader + " who was famous for his past exploits. Along the way, the group of comrades were attacked by the god's loyal followers. The adventurers fought with bravado and strength under the tutelage of "+ leader + " the followers were defeated but they still suffered great losses. After a headcount of the remaining squad, "+ adventurersKilled +" were found to be dead which left only " + survivors + " remaining survivors.\n");
console.log("Current Statistics :\n");console.log("Total Adventurers = " + numberOfAdventurers);console.log("Total Killed = " +…
arrow_forward
A struct to store a single playing card is as follows: struct card { char suit; char kind; }; The valid suits are 'S', 'H', 'D' and 'C', while the valid kinds are 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', and 'K'. A poker hand can be stored as an array of five struct cards. A flush is a hand that contains five cards, all of the same suit. Write a function that returns 1, if the poker hand passed to it has five cards of the same suit, and 0 otherwise.
int isFlush(struct card hand[]); int isFlush(struct card hand[]) {
arrow_forward
JAVA ONLYPlease create a code that checks if 'user' favourite game is in the top 3 games. if the game is in the top 3 then it should say: "common favourite game" if else then "uncommon favourite game"code:
TOP_3_GAMES = {'', 'CALL OF DUTY', 'LEAGUE OF LEGENDS', 'VALORANT'}
arrow_forward
#include
#include
#include "Product.h"
using namespace std;
int main() {
vector productList;
Product currProduct;
int currPrice;
string currName;
unsigned int i;
Product resultProduct;
cin>> currPrice;
while (currPrice > 0) {
}
cin>> currPrice;
main.cpp
cin>> currName;
currProduct.SetPriceAndName (currPrice, currName);
productList.push_back(currProduct);
resultProduct = productList.at (0);
for (i = 0; i < productList.size(); ++i) {
Type the program's output
Product.h
1
CSE Scanned
Product.cpp
if (productList.at (i).GetPrice () < resultProduct.GetPrice ()) {
resultProduct = productList.at(i);
}
AM
cout << "$" << resultProduct.GetPrice() << " " << resultProduct. GetName() << endl;
return 0;
Input
10 Cheese
6 Foil
7 Socks
-1
Output
arrow_forward
QUESTION 21
int x1=200;
int y1=3003;
int z1, z2, z3, z4;
int d1, d2, d3;
_asm{
mov EAX, x1; 200
mov EBX, y1; 300
mov z1, ESP; assume initial ESP: OFFF FFEA
add EAX, x1; 400
push EAX;
mov d1, EAX:400
mov z2, ESP;
push EBX;
SUB EBX, x1; 300-200=100
mov d2, EBX;
mov 23, ESP;
POP ECX;
MOV d3, ECX;
MOV z4, ESP;
POP EDX;
mov d4, EDX;
What is z3 in Hexidecimal?
O OFFF FFEA
O OFFF FFE6
OFFF FFE2
OFFF FFEE
arrow_forward
c++
arrow_forward
JSON Response example when code = BAHRAIN as follows:
{ "Country": "Bahrain",
"Tenps"il
("day": "SUNDAY", "temp"i
{"day": "HONDAY", "temp": 35),
("day": "TUESDAYr, "teng": 39),
("day": "WEDNESDAY", "tenp": 37),.
("day"i "THURSDAY", "tenp": 35),
("day"i "FRIDAV", "temp": 34),
("day": "SATURDAY", "teng": 37)
1.
Implement find Templ ) function as follows:
Sample Eample
This function will be called whenever the user change the
value of the pull-down menu. This function should contact Ve
the Web Service API, sending the selected country code, to
Co
display the information (country, daily temperatures in the
week and average weekly temperature) inside the div tag
whose id -result as shown in the example on the right.
Country ahraln
In addition, the country name and the average temperatures
should be saved as one JS object inside an array in a local
storage. Whenever new request is made, the countrylaverage
will be saved and added to the array inside the local storage
(duplicates is allowed).…
arrow_forward
#include
#include
#include "Product.h".
using namespace std;
int main() {
vector productList;
Product currProduct;
int currPrice;
string currName;
unsigned int i;
Product resultProduct;
cin >> currPrice;
while (currPrice > 0) {
cin >> currName;
currProduct.SetPriceAndName (currPrice, currName);
productList.push_back (currProduct);
cin >> currPrice;
}
resultProduct = productList.at(0);
for (i = 0; i resultProduct.GetPrice()) {
resultProduct = productList.at(i);
}
CS
re 0;
ultProduct.GetName() << " " << result Product.GetPrice() << endl;
Input
10 Berries
8 Paper
7 Socks
-1
Output
||^
arrow_forward
No need for explanation only the answer or what to write please and thank you
arrow_forward
Given a map pre-filled with student names as keys and grades as values, complete main() by reading in the name of a student, outputting
their original grade, and then reading in and outputting their new grade.
Ex: If the input is:
Quincy Wraight
73.1
the output is:
Quincy Wraight's original grade: 65.4
Quincy Wraight's new grade: 73.1
arrow_forward
#include<stdio.h>#include<stdlib.h>
int cent50=0;int cent20=0;int cent10=0;int cent05=0;
void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…
arrow_forward
#include<stdio.h>#include<stdlib.h>
int cent50=0;int cent20=0;int cent10=0;int cent05=0;
void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…
arrow_forward
#include<stdio.h>#include<stdlib.h>
int cent50=0;int cent20=0;int cent10=0;int cent05=0;
void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…
arrow_forward
==
include using namespace std; #
int main () { int a = 14; do { if( a
15) { a = a + 1; } cout << a <<" "; a = a
+ 1; } while( a < 16 ); }
الجواب:
إجابة
arrow_forward
#include <stdio.h>#include <string.h>
struct user { char user_name[10]; char bank_name[10]; int account_num[4]; int card_number[14]; int pass[4]; int balance; int wallet_num[11];};
int num_acc;int withdrawal;int deposition;char transaction;int k;int number_of_papers;int choice4;
void print_array(int arr[], int size){ for (int i = 0; i < size; i++) { printf("%d", arr[i]); } printf("\n");}
void print_struct(char username[], char bankname[], int accountnum[], int size3, int cardnum[], int size4, int balance){ printf("Username is %s", username); printf("\nBankname is %s\n", bankname); printf("Account number is "); print_array(accountnum, size3); printf("Cardnumber is "); print_array(cardnum, size4); printf("Balance is %d\n", balance);}
void scan_array(int arr[], int size){ for (int i = 0; i < size; i++) { scanf_s("%d", &arr[i]); }
}
int search_name_in_array(struct user user[], int size1, char…
arrow_forward
// Assume all libraries are included
3
void
func (int a, int &b, int &c);
//
int main ()
{
int i = 5, j = 4, k = 33;
4
7
%3D
8.
func (i, j, k);
func (j, i, k);
cout << j « k << i <« endl;
10
11
12
13
return 0;
14
}
//
15
16
void func (int a, int &b, int &c)
{
17
18
= 2*c + b;
19
b
a;
20
C = a + 3*b;
}
//
21
22
I|||
arrow_forward
using System;
using System.Linq;
using System.Text;
namespace Games;
{
class Program
{
staticvoid Main(string[] args)
{
int choice,games_choice;
cout<<"What are your favorite games - outdoor or indoor"<<endl;
cout<<"Press 1 for 'outdoor' or Press 2 for 'indoor'"<<endl;
cin>>choice;
if(choice==1)
{
cout<<"What is your favorite outdoor game"<<endl;
cout<<"Press 1 for Tennis"<<endl;
cout<<"Press 2 for Football"<<endl;
cout<<"Press 3 for Cricket"<<endl;
cin>>games_choice;
if(games_choice==1)
cout<<"I also like Tennis"<<endl;
elseif(games_choice==2)
cout<<"I also like Football"<<endl;
elseif(games_choice==3)
cout<<"I also like Cricket"<<endl;
}
elseif(choice==2)
{
cout<<"What is your favorite indoor game"<<endl;
cout<<"Press 1 for Ludo"<<endl;
cout<<"Press 2 for Chess"<<endl;
cout<<"Press 3 for Cards"<<endl;…
arrow_forward
The enum class construct:
Select one:
a.
does not require one to write anything in front of an enumeration value-name
b.
requires one to use the name of the enumeration, followed by "::" (colon-colon), before each name whenever the enumeration's value-name is used
c.
requires one to use the name of the enumeration, followed by "." (period), before each name whenever an enumeration's value-name is used
arrow_forward
Welcome Assignment
### welcome_assignment_answers
### Input - All eight questions given in the assignment.
### Output - The right answer for the specific question.
def welcome_assignment_answers(question):
# The student doesn't have to follow the skeleton for this assignment.
# Another way to implement it is using "case" statements similar to C.
if question == "Are encoding and encryption the same? - Yes/No":
answer = "The student should type the answer here"
elif question == "Is it possible to decrypt a message without a key? - Yes/No":
answer = "The student should type the answer here"
return (answer)
# Complete all the questions.
if __name__ == "__main__":
# use this space to debug and verify that the program works
debug_question = "Are encoding and encryption the same? - Yes/No"
print(welcome_assignment_answers(debug_question))
As you can see, the first two questions are already in the skeleton code. Please follow the first two questions…
arrow_forward
Screen Output
#include
#include
#define MAX 3
typedef struct
{
char part[20];
int quantity;
float price;
}partsRecord;
void myParts (void);
void printBin(partsRecord *recBin);
int main(void)
{
myParts();
return(0);
}
void myParts (void)
{
partsRecord Bin[MAX] = { { "Resistor", 300, 0.05 },
{ "Capacitor", 250, 1.03 },
{ "Inductor", 123, 0.65 }};
int index;
for (index
{
0; index part, recBin->quantity, recBin->price);
return;
}
2c) What type of argument is passed to the printBin function?
arrow_forward
int grades[100];
int i;
for (i=0;i <= 100;i++)
{
grades[i) = 100;
}
The above C++ code is the proper way to initialize the grades array, TRUE or FLASE
True
False
arrow_forward
Consider the code and select the wrong choice.
class hero
{
char name[10];
public : void disp()
{
cout<<name;
}
};
a) This maintains encapsulation
b) This code doesn’t maintain encapsulation
c) This code is vulnerable
d) This code gives error
arrow_forward
None
arrow_forward
struct gameType
{
string title;
int numPlayers;
bool online;
};
gameType Awesome[50];
Write the C++ statements that print out all gameType fields from Awesome whose numPlayers is > 1.
arrow_forward
int main(){ long long int total; long long int init;
scanf("%lld %lld", &total, &init); getchar();
long long int max = init; long long int min = init;
int i; for (i = 0; i < total; i++) { char op1 = '0'; char op2 = '0';
long long int num1 = 0; long long int num2 = 0;
scanf("%c %lld %c %lld", &op1, &num1, &op2, &num2); getchar();
long long int maxr = max; long long int minr = min;
if (op1 == '+') { long long int sum = max + num1;
maxr = sum; minr = sum;
long long int res = min + num1;
if (res > maxr) { max = res; }
if (res < minr) { minr = res; } } else { long long int sum = max * num1;
maxr = sum; minr = sum;
long long int res = min * num1;…
arrow_forward
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
constdouble MONSTERA_PRICE =11.50;
constdouble PHILODENDRON_PRICE =13.75;
constdouble HOYA_PRICE =10.99;
constint MAX_POTS =20;
constdouble POINTS_PER_DOLLAR =1.0/0.75;
char plantType;
int quantity;
double totalAmount =0.0;
int totalPoints =0;
int availablePots =0;
double plantPrice =0.0;
cout << "Welcome to Tom's Plant Shop!" << endl;
cout << "******************************" << endl;
cout << "Enter your full name: ";
string fullName;
getline(cin, fullName);
output:
compiling code...
Welcome to Tom's Plant Shop!----------------------------------------Enter your full name: ______
Available plants:M - Monstera ($ 11.5)P - Philodendron ($13.75)H - Hoya ($10.99)Q - Quit shoppingEnter the plant type (M/P/H/Q): ________
Part 1
Tom has recently started a plant-selling business, and he offers three different types of plants, namely Monstera,…
arrow_forward
None
arrow_forward
#include <iostream>
#include <ctime>
#include <cmath>
const int MAX = 1000;
const char CLASS[] = {'A','B','C'};
struct Points{
int x,y;
char c;
double dist(Points q){
return sqrt(pow(x-q.x,2)+pow(y-q.y,2));
}
};
int main(){
return 0;
}
int main(){
srand(time(0));
}
arrow_forward
def calculate_growth_cycle(plant_name): if(plant_name == "strawberry"): print("### The life cycle of a strawberry ###\nA seed takes 110 days to reach maturity.") elif(plant_name == "cucumber"): print("### The life cycle of a cucumber ###\nA seed takes 76 days to reach maturity.") elif(plant_name == "potato"): print("### The life cycle of a potato ###\nA seed takes 120 days to reach maturity.") else: print('Your plant is available, please try "strawberry", "cucumber" or "potato"')
Plants Growth Cycle
Learning Objectives
In this lab, you will practice:
Defining a function to match the given specifications
Calling the function in your program
Using if statements (can combine them with dictionaries)
Instructions
For every plant, there is a growth cycle. The number of days that it takes starting from being a seed and ending in being a fruit is what is called the growth cycle. Write a function that takes a plant's name as an argument and…
arrow_forward
#include <iostream>#include <string>#include <climits>using namespace std;
class BalancedTernary {protected:// Store the value as a reversed string of +, 0 and - charactersstring value;
// Helper function to change a balanced ternary character to an integerint charToInt(char c) const {if (c == '0')return 0;return 44 - c;}
// Helper function to negate a string of ternary charactersstring negate(string s) const {for (int i = 0; i < s.length(); ++i) {if (s[i] == '+')s[i] = '-';else if (s[i] == '-')s[i] = '+';}return s;}
public:// Default constructorBalancedTernary() {value = "0";}
// Construct from a stringBalancedTernary(string s) {value = string(s.rbegin(), s.rend());}
// Construct from an integerBalancedTernary(long long n) {if (n == 0) {value = "0";return;}
bool neg = n < 0;if (neg)n = -n;
value = "";while (n != 0) {int r = n % 3;if (r == 0)value += "0";else if (r == 1)value += "+";else {value += "-";++n;}
n /= 3;}
if (neg)value = negate(value);}
// Copy…
arrow_forward
struct Player
{
string firstName;
string lastName;
int hits;
int runs;
};
int main()
{
Player p = { "Jackie", "Robinson", 1518, 947 };
Player team[24];
Player *tPtr = team;
team[0] = p;
// INSERT CODE HERE
}
The statement tPtr = team+9; will assign the same memory address to tPtr as the statement tPtr = &(team[9]);
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- debugarrow_forwardvar adventurersName = ["George", " Tim", " Sarah", " Mike", " Edward"];var adventurersKilled = 3;var survivors;var leader = "Captain Thomas King";var numberOfAdventurers = adventurersName.length; survivors = numberOfAdventurers - adventurersKilled; console.log("Welcome to The God Among Us\n");console.log("A group of adventurers began their search for the mystical god said to live among us. In charge of the squad was " + leader + " who was famous for his past exploits. Along the way, the group of comrades were attacked by the god's loyal followers. The adventurers fought with bravado and strength under the tutelage of "+ leader + " the followers were defeated but they still suffered great losses. After a headcount of the remaining squad, "+ adventurersKilled +" were found to be dead which left only " + survivors + " remaining survivors.\n"); console.log("Current Statistics :\n");console.log("Total Adventurers = " + numberOfAdventurers);console.log("Total Killed = " +…arrow_forwardA struct to store a single playing card is as follows: struct card { char suit; char kind; }; The valid suits are 'S', 'H', 'D' and 'C', while the valid kinds are 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', and 'K'. A poker hand can be stored as an array of five struct cards. A flush is a hand that contains five cards, all of the same suit. Write a function that returns 1, if the poker hand passed to it has five cards of the same suit, and 0 otherwise. int isFlush(struct card hand[]); int isFlush(struct card hand[]) {arrow_forward
- JAVA ONLYPlease create a code that checks if 'user' favourite game is in the top 3 games. if the game is in the top 3 then it should say: "common favourite game" if else then "uncommon favourite game"code: TOP_3_GAMES = {'', 'CALL OF DUTY', 'LEAGUE OF LEGENDS', 'VALORANT'}arrow_forward#include #include #include "Product.h" using namespace std; int main() { vector productList; Product currProduct; int currPrice; string currName; unsigned int i; Product resultProduct; cin>> currPrice; while (currPrice > 0) { } cin>> currPrice; main.cpp cin>> currName; currProduct.SetPriceAndName (currPrice, currName); productList.push_back(currProduct); resultProduct = productList.at (0); for (i = 0; i < productList.size(); ++i) { Type the program's output Product.h 1 CSE Scanned Product.cpp if (productList.at (i).GetPrice () < resultProduct.GetPrice ()) { resultProduct = productList.at(i); } AM cout << "$" << resultProduct.GetPrice() << " " << resultProduct. GetName() << endl; return 0; Input 10 Cheese 6 Foil 7 Socks -1 Outputarrow_forwardQUESTION 21 int x1=200; int y1=3003; int z1, z2, z3, z4; int d1, d2, d3; _asm{ mov EAX, x1; 200 mov EBX, y1; 300 mov z1, ESP; assume initial ESP: OFFF FFEA add EAX, x1; 400 push EAX; mov d1, EAX:400 mov z2, ESP; push EBX; SUB EBX, x1; 300-200=100 mov d2, EBX; mov 23, ESP; POP ECX; MOV d3, ECX; MOV z4, ESP; POP EDX; mov d4, EDX; What is z3 in Hexidecimal? O OFFF FFEA O OFFF FFE6 OFFF FFE2 OFFF FFEEarrow_forward
- c++arrow_forwardJSON Response example when code = BAHRAIN as follows: { "Country": "Bahrain", "Tenps"il ("day": "SUNDAY", "temp"i {"day": "HONDAY", "temp": 35), ("day": "TUESDAYr, "teng": 39), ("day": "WEDNESDAY", "tenp": 37),. ("day"i "THURSDAY", "tenp": 35), ("day"i "FRIDAV", "temp": 34), ("day": "SATURDAY", "teng": 37) 1. Implement find Templ ) function as follows: Sample Eample This function will be called whenever the user change the value of the pull-down menu. This function should contact Ve the Web Service API, sending the selected country code, to Co display the information (country, daily temperatures in the week and average weekly temperature) inside the div tag whose id -result as shown in the example on the right. Country ahraln In addition, the country name and the average temperatures should be saved as one JS object inside an array in a local storage. Whenever new request is made, the countrylaverage will be saved and added to the array inside the local storage (duplicates is allowed).…arrow_forward#include #include #include "Product.h". using namespace std; int main() { vector productList; Product currProduct; int currPrice; string currName; unsigned int i; Product resultProduct; cin >> currPrice; while (currPrice > 0) { cin >> currName; currProduct.SetPriceAndName (currPrice, currName); productList.push_back (currProduct); cin >> currPrice; } resultProduct = productList.at(0); for (i = 0; i resultProduct.GetPrice()) { resultProduct = productList.at(i); } CS re 0; ultProduct.GetName() << " " << result Product.GetPrice() << endl; Input 10 Berries 8 Paper 7 Socks -1 Output ||^arrow_forward
- No need for explanation only the answer or what to write please and thank youarrow_forwardGiven a map pre-filled with student names as keys and grades as values, complete main() by reading in the name of a student, outputting their original grade, and then reading in and outputting their new grade. Ex: If the input is: Quincy Wraight 73.1 the output is: Quincy Wraight's original grade: 65.4 Quincy Wraight's new grade: 73.1arrow_forward#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education