Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 349 páginas
Examen

SOLUTION MANUAL FOR Data Abstraction & Problem Solving with C++: Walls and Mirrorsby Frank Carrano , Timothy Henry ISBN:978-0134463971 NEW COMPLETE GUIDE WITH RATIONALES 100% VERIFIED A+ GRADE ASSURED!!!!!NEW LATEST UPDATE!!!

Document preview thumbnail
Vista previa 4 fuera de 349 páginas

SOLUTION MANUAL FOR Data Abstraction & Problem Solving with C++: Walls and Mirrorsby Frank Carrano , Timothy Henry ISBN:978-0134463971 NEW COMPLETE GUIDE WITH RATIONALES 100% VERIFIED A+ GRADE ASSURED!!!!!NEW LATEST UPDATE!!!

Vista previa del contenido

Solutions to Selected Exercises
a w a w a w




(Version 7.0) aw




Data Abstraction & Problem Solving with C++
aw aw aw aw aw aw




Seventh Edition a w




Frank M. Carrano aw aw




University of Rhode Island
aw aw aw




Timothy M. Henry aw aw




New England Institute of Technology
aw aw aw aw

, 2


Solution Manual & Test Bank for Data Abstraction & Problem Solving with C++: Walls and Mirrors, 7th Edition by Frank M. Carrano
aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw




Chapter 1 Data Abstraction: The Walls aw aw aw aw aw




1
const CENTS_PER_DOLLAR = 100;
aw aw aw




/** Computes the change remaining from purchasing an item costing dollarC
aw aw aw aw aw aw aw aw aw aw


ost dollars and centsCost cents with d dollars and c cents. Preconditi
aw aw aw aw aw aw aw aw aw aw aw



on: dollarCost, centsCost, d and c are all nonnegative integers and ce
aw aw aw aw aw aw aw aw aw aw aw



ntsCost and c are both less than CENTS_PER_DOLLAR. Postcondition: d a
aw aw aw aw aw aw aw aw aw aw



nd c contain the computed remainder values in dollars and cents respec
aw aw aw aw aw aw aw aw aw aw aw


tively. If input value d < dollarCost, the proper negative values for
aw aw aw aw aw aw aw aw aw aw aw aw


the amount owed in d dollars and/or c cents is returned. */
aw aw aw aw aw aw aw aw aw aw aw



void computeChange(int dollarCost, int centsCost, int& d, int& c);
aw aw aw aw aw aw aw aw




2a
const MONTHS_PER_YEAR = 12;
aw aw aw



const DAYS_PER_MONTH[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
aw aw aw aw aw aw aw aw aw aw aw aw aw aw




/** Increments the input Date values (month, day, year) by one day.
aw aw aw aw aw aw aw aw aw aw aw



Precondition: 1 <= month <= MONTHS_PER_YEAR, aw aw aw aw aw



1 <= day <= DAYS_PER_MONTH[month - 1], except aw aw aw aw aw aw aw



when month == 2, day == 29 and isLeapYear(year) is true. Postcondit aw aw aw aw aw aw aw aw aw aw aw



ion: The valid numeric values for the succeeding month, day,
aw aw aw aw aw aw aw aw aw



and year are returned. */ aw aw aw aw


void incrementDate(int& month, int& day, int& year);
aw aw aw aw aw aw




/** Determines if the input year is a leap year.
aw aw aw aw aw aw aw aw aw



Precondition: year > 0. aw aw aw



Postcondition: Returns true if year is a leap year; false otherwise. */ aw aw aw aw aw aw aw aw aw aw aw



bool isLeapYear(int year);
aw aw




3a
changeAppointmentPurpose(apptDate: Date, apptTime: Time, purpose: string): boolean aw aw aw aw aw aw



{
if (isAppointment(apptDate, apptTime)) cancelAppointment(apptDate
aw aw aw


, apptTime) aw




return makeAppointment(apptDate, apptTime, purpose)
aw aw aw


}




© 2017 Pearson Education, Inc., Hoboken, New Jersey 070
aw aw aw aw aw aw aw aw


30

, 3



3b
displayAllAppointments(apptDate: Date): void aw aw



{
time = START_OF_DAY aw aw



while (time < END_OF_DAY) aw aw aw



if (isAppointment(apptDate, time)) displa
aw aw aw


yAppointment(apptDate, time) aw



time = time + HALF_HOURaw aw aw aw



}
This implementation requires the definition of a new operation
aw aw aw aw aw aw aw aw




displayAppointment()
as well as definitions for the constants START_OF_DAY, END_OF_DAY and HALF_HOUR.
aw a w aw aw aw aw aw aw aw a w




4
// Assume that storeBag is defined and contains your purchased items Bag<std::string>
aw aw aw aw aw aw aw aw aw aw aw aw


fragileBag;
while (storeBag.contains("eggs"))
aw


{
storeBag.remove("eggs"); fragileBag.add("eggs" aw



);
} // end while
a w aw aw




while (storeBag.contains("bread"))
aw



{
storeBag.remove("bread"); fragileBag.add("brea aw



d");
} // end while
a w aw aw




// Transfer remaining items from storeBag to groceryBag; Bag<std::st
aw aw aw aw aw aw aw aw


ring> groceryBag; aw



v = storeBag.toVector();
aw aw



for (int i = 0; i < v.size(); i++) groceryBag.add
aw aw aw aw aw aw aw aw aw


(v.at(i));




© 2017 Pearson Education, Inc., Hoboken, New Jersey 070
aw aw aw aw aw aw aw aw


30

, 4



5
/** Removes and counts all occurrences, if any, of a given string from
aw aw aw aw aw aw aw aw aw aw aw aw aw



a given bag of strings.
aw aw aw aw



@param bag A given bag of strings. @pa
aw aw aw aw aw aw aw



ram givenString A string.
aw aw aw



@return The number of occurrences of givenString that occurred and
aw aw aw aw aw aw aw aw aw aw



were removed from the given bag. */
aw aw aw aw aw aw



int removeAndCount(ArrayBag<std::string>& bag, std::string givenString)
aw aw aw aw


{
int counter = 0; aw aw aw



while (bag.contains(givenString))
aw


{
counter++; bag.remove(givenString aw



);
} // end while
a w aw aw



return counter; aw



} // end removeAndCount
a w aw aw




6
/** Creates a new bag that combines the contents of this bag and a second ba
aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw



g without affecting the contents of the original two bags.
aw aw aw aw aw aw aw aw aw



@param anotherBag The second bag.
aw a w aw aw



@return A bag that is the union of the two bags. */
a w aw aw aw aw aw aw aw aw aw aw



public BagInterface<ItemType> union(BagInterface<ItemType> anotherBag);
aw aw aw




7
/** Creates a new bag that contains those objects that occur in both this
aw aw aw aw aw aw aw aw aw aw aw aw aw



bag and a second bag without affecting the contents of the original two bags. @par
aw aw aw aw aw aw aw aw aw aw aw aw aw aw


am anotherBag The given bag.
aw aw aw aw



@return A bag that is the intersection of the two bags. */
a w aw aw aw aw aw aw aw aw aw aw


public BagInterface<ItemType> intersection(BagInterface<ItemType> anotherBag);
aw aw aw




8
/** Creates a new bag of objects that would be left in this bag after removing those ob
aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw



jects that also occur in a second bag without the contents of the original two bag
aw aw aw aw aw aw aw aw aw aw aw aw aw aw aw


s.
@param anotherBag The given bag.
aw a w aw aw



@return A bag that is the difference of the two bags. */
a w aw aw aw aw aw aw aw aw aw aw



public BagInterface<T> difference(BagInterface<T> anotherBag);
aw aw aw




© 2017 Pearson Education, Inc., Hoboken, New Jersey 070
aw aw aw aw aw aw aw aw


30

Información del documento

Subido en
27 de agosto de 2026
Número de páginas
349
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$18.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Brightspark
3.7
(3)
Vendido
17
Seguidores
0
Artículos
470
Última venta
1 mes hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes