In the program the "case: 'C'" doesn't seem to function correctly,
We were told to write a book tracking program, and it takes inputs and once all the book info such as ISBN, date, author, course number, etc are put in then input, then we can print them out, by using the print functions that are defined in the program. Example:
the formats are as follows, when defining the book: "B-ISBN-TITLE"
So then in the terminal once the code compiles I can input: "B 1234567890123 Title of book"
and thus that book is defined, and I needed to make the code print the books info out and it's format were "GB-ISBN"
So then in the terminal after the book is defined I can type "GB 1234567890123" and the isbn and books title will be printed out that were define above.
NOW my problem is with the C which defines a course and it's format is "C-Department Code-Course Number-Name"
So if type "C CSEC 215 Name of the course" it should store it, until I use the print function "PC" which will print out the course that are defined. BUT I am getting an "abort message, out of range", and it points the error at the "case: C" switch statement in the code.
Can someone take a look at the code and help me figure out the solution,
Here is the code:
#include
#include
#include
#include
using namespace std;
int bookCounter = 0, courseCounter = 0, classCounter = 0;
struct Book
{
long isbn;
string title;
string author;
int edition;
string publicationDate;
double newRate = -1;
double usedRate = -1;
double rentedRate = -1;
double eRate = -1;
}* books[100];
struct Course
{
int deptCode;
int courseNumber;
string name;
}*course[100];
struct Class
{
struct Book *book;
struct Course *course;
int sectionNumber;
bool required;
}*classes[100];
int getBook( long newISBN)
{
for(int i=0; i {
if(books[i]->isbn == newISBN)
{
return i;
}
}
return -1;
}
int getCourse(int courseNum, int dept)
{
for(int i=0; i {
if(course[i]->courseNumber == courseNum &&
course[i]->deptCode == dept)
{
return i;
}
}
return -1;
}
void printBooks(string code, istringstream &iss)
{
int deptCode, sectionNum, courseNum;
long isbn;
if(code == "GC") iss>>deptCode>>courseNum;
else if(code=="GS")
iss>>deptCode>>courseNum>>sectionNum;
else if(code == "GB") iss>>isbn;
for(int i=0; i {
if(code=="GB" && classes[i]->book->isbn==isbn)
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
else if(classes[i]->course->courseNumber == courseNum
&& classes[i]->course->deptCode == deptCode)
{
if(code=="GS" && classes[i]->sectionNumber ==
sectionNum)
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
if(code == "GC")
{
coutisbn<<" "title<<" ";
if(classes[i]->required)
cout<<"Required\n";
else cout<<"Optional\n";
}
}
}
}
void printAllInfo(string code, istringstream &iss)
{
if(code == "PB")
{
for(int i=0; i {
cout
if(classes[i]->course->deptCode==deptCode)
{
coutisbn<<" "title<<"\n";
}
}
}
else if(code == "PY")
{
int pmonth, pyear, checkMonth, checkYear;
int ch;
iss>>checkMonth>>ch>>checkYear;
for(int i=0; i {
istringstream isstreamer(books[i]->publicationDate);
isstreamer>>pmonth>>ch>>pyear;
if((pyear==checkYear &&
pmonth>checkMonth)||(pyear>checkYear))
{
cout
In: Computer Science
| A | The slit width is halved. |
| B | The distance between the slits and the screen is halved. |
| C | The slit width is doubled. |
| D | A green, rather than red, light source is used. |
| E | The experiment is conducted in a water-filled tank. |
| F | The distance between the slits and the screen is doubled. |
In: Physics
Assume that you have been asked to design an experiment for the marketing department of a major automotive company. They would like to know what color(s) are most appealing to 18-24 year olds who purchase new trucks.
Design an appropriate experiment, and then submit a short (< 3 pages) Technical Memo presenting your proposal.
At a minimum, your memo should include:
• A clear objective statement for your experiment
• Procedure for collecting data
• Methodology for analyzing the data
• Proposed method for presenting the data and drawing conclusions
• Estimated cost of the experiment, including equipment and labor
In: Statistics and Probability
Dieting is common in our society and everyone wants a piece of the action. So many diets are available to choose from if someone wants to change their health; e.g., lose weight. Often times, diets are promoted with claims of great success.
Choose a particular diet and analyze it in terms of scientific evidence, or lack thereof. Then, design a controlled experiment to test a hypothesis based on this diet. The experiment must include multiple individuals within a control and experimental group. Specify how you will measure the outcome of the experiment identifying both the independent and dependent variables. Describe the potential outcomes of the experiment in terms of supporting the hypothesis.
In: Anatomy and Physiology
At the end of the CD triaxial pressure experiment on a normal consolidated clay, the sample was defeated along a plane of 570. When another sample with the same properties was tested in the CU experiment, the pore pressure in the defeat was measured as 85 kPa. According to the cell pressures (63) 200 kPa in both experiments; a) At the end of the A = CD experiment, find the effective internal friction angle and the difference in prime stress. b) At the end of B = CU experiment, find the total angle of internal friction and angle of defeat plane. c) In the C = CU test, find the shear strength in the plane of failure.
In: Civil Engineering
A certain chemistry instructor felt that there were some "dry-labbers" in the chemistry course. ["Dry-labbers" think they know the answer to a lab experiment, and give their expected answer without doing the experiment--which isn't fair to the others in the lab!] So, all students in the lab were asked to determine the boiling point of pure water contained in a flask labeled "pure water." The "pure water" was actually a very concentrated calcium dichloride solution. Three students were caught not actually doing the experiment and given F's for their experiment. Explain how the chemistry instructor was able to catch the dishonest "dry-labbers."
In: Chemistry
#11 According to an airline, flights on a certain route are on
time 75% of the time. Suppose 15 flights are randomly selected and
the number of on-time flights is recorded.
(a) Explain why this is a binomial experiment.
(b) Find and interpret the probability that exactly 9 flights are
on time.
(c) Find and interpret the probability that fewer than 9 flights
are on time.
(d) Find and interpret the probability that at least 9 flights are
on time.
(e) Find and interpret the probability that between 7 and 9
flights, inclusive, are on time.
Identify the statements that explain why this is a binomial experiment. Select all that apply.
A. There are two mutually exclusive outcomes, success or failure.
B. The experiment is performed until a desired number of successes is reached.
C. There are three mutually exclusive possibly outcomes, arriving on-time, arriving early, and arriving late.
D. Each trial depends on the previous trial.
E. The probability of success is the same for each trial of the experiment.
F. The experiment is performed a fixed number of times.
G. The trials are independent.
b) The probability that exactly 9 flights are on time is
In 100 trials of this experiment, it is expected about __ to result in exactly 9 flights being on time.
c) The probability that fewer than 9 flights are on time is ____
In 100 trials of this experiment, it is expected about ___ to result in at least 9 flights being on time.
e) The probability that between 7 and 9 flights, inclusive, are on time is ___
In 100 trials of this experiment, it is expected about ___ to result in between 7 and 9 flights, inclusive, being on time.(Round to the nearest whole number as needed.)
In: Statistics and Probability
This is a Lab Report about an experiment.
The experiment should be about HEAT and TEMPERATURE with any example.
Title:
Hypothesis: Statement that the experiment is going to test, prove, or disprove. What is the point of the experiment? (Make a statement that the experiment will either prove or disprove.)
Overview: Brief summary of what occurred in the experiment or what was tested and how.
Uncertainty&Error: Can you trust your data?
Considerations:
1) What factors may have affected or biased the data and introduced uncertainty in the lab measurements? Or, what conditions created uncertainty in your measurements? Which measurements were most affected?”
2) If you were conducting the lab in a physical environment, what other factors would have to be taken into account while accomplishing the procedures? How might they affect the data and/or experiment outcome?
Conclusion/Summary: This section must contain each of the items listed below. You are now the one speaking, of your personal results. Although this is merely an example, it does contain all the requisite components. You may write this section how you see fit, as long as the items annotated are included. However, a checklist or bullet list is not acceptable. The clarity and flow of your conclusion/summary should make clear to any ready what you did in the experiment and how it turned out.
Application: How does this topic—and science in general—impact our understanding of the complex, technological society of which we are a part? How does this explain something in the real world around you?
In: Physics
I am confused about how the pattern and how to get only some letters that are needed and numbers?
New Perspectives HMTL5, CSS3, and JavaScript Chapter 13 Case Problem 2
HTML Document
Scroll down to the empInfo table and add pattern attributes to the following fields using regular expressions (Note: Regular expressions in the HTML pattern attribute do not include the opening and closing / character):
Take some time to study the class names for the input elements in the travelExp table. This table will be used to calculate the total travel expenses for each day and across all categories.
Note that input elements that contribute to the total are placed in the sum class. Inputelements belonging to a common date are placed in the date0 through date5 classes. Finally, input elements belonging to different expense categories are placed in the trans, lodge, meal, and other classes.
<!DOCTYPE html>
<html lang="en">
<head>
<!--
New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
Tutorial 13
Case Problem 2
Travel Expense Report
Author:
Date:
Filename: dl_expenses.html
-->
<title>DeLong Enterprises Expense Report</title>
<meta charset="utf-8" />
<link href="dl_base.css" rel="stylesheet" />
<link href="dl_layout.css" rel="stylesheet" />
<script src="dl_expenses.js" async></script>
</head>
<body>
<header>
<nav class="horizontal">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Policies</a></li>
<li><a href="#">Reports</a></li>
<li><a href="#">Employment</a></li>
<li><a href="#">Financial</a></li>
<li><a href="#">Insurance</a></li>
<li><a href="#">Accounts</a></li>
</ul>
</nav>
<img src="dl_logo.png" alt="DeLong Enterprises" id="logoImg" />
</header>
<section>
<form name="expReport" id="expReport" method="post" action="dl_valid.html">
<table id="travelSummary">
<tr>
<th>Trip Summary<span>*</span></th>
</tr>
<tr>
<td>
<textarea id="summary" name="summary" required></textarea>
</td>
</tr>
</table>
<aside>
<h1>Expense Report</h1>
<p>Form: 2CEXP15<br />
* --- Required Field
</p>
<p>Send Report To:<br />
Debbie Larson<br />
Personnel Dept.<br />
Rm. 3801<br />
Ext. 1250
</p>
</aside>
<table id="empInfo">
<tr>
<th>Last Name<span>*</span></th>
<th>First Name<span>*</span></th>
<th>M.I.</th>
<th>Account<span>*</span></th>
<td><input type="text" name="accID" id="accID" pattern="\d{6}$" placeholder="ACTnnnnnn" required /></td>
</tr>
<tr>
<td><input type="text" name="lname" id="lname" required /></td>
<td><input type="text" name="fname" id="fname" required /></td>
<td><input type="text" name="init" id="init" required /></td>
<th>Department<span>*</span></th>
<td><input type="text" name="deptID" id="deptID" required placeholder="DEPTnnnnnn" /></td>
</tr>
<tr>
<th>Social Security Number<span>*</span></th>
<td colspan="2"><input type="text" name="ssn" id="ssn" required placeholder="nnn-nn-nnnn" /></td>
<th>Project<span>*</span></th>
<td><input type="text" name="projID" id="projID"
In: Computer Science
Alternative Inventory Methods
Frate Company was formed on December 1, 2015, and uses the periodic inventory system. The following information is available from Frate's inventory records for Product Ply:
| Units | Unit Cost | |||
|---|---|---|---|---|
| January 1, 2016 (beginning inventory) | 800 | $ 9.00 | ||
| Purchases: | ||||
| January 6, 2016 | 1,500 | 10.00 | ||
| January 25, 2016 | 1,200 | 10.50 | ||
| February 17, 2016 | 600 | 11.00 | ||
| March 27, 2016 | 900 | 11.50 | ||
A physical inventory on March 31, 2016 shows 1,600 units on hand.
Required:
For each method, enter your answers in chronological order.
Prepare schedules to compute the ending inventory at March 31,
2016, under each of the following inventory methods:
1. FIFO
| FRATE COMPANY | |||
| Computation of Inventory for Product Ply Under FIFO Inventory Method | |||
| March 31, 2016 | |||
| Units | Unit cost | Total cost | |
| March 27, 2016 | ______ | $______ | $______ |
| February 17, 2016 | ______ | _______ | _______ |
| January 25, 2016 (portion) | ______ | _______ | _______ |
| March 31, 2016 inventory | ______ | _______ | $______ |
2. LIFO
| FRATE COMPANY | |||
| Computation of Inventory for Product Ply Under LIFO Inventory Method | |||
| March 31, 2016 | |||
| Units | Unit cost | Total cost | |
| Beginning inventory | _____ | $______ | $______ |
| January 6, 2016 (portion) | ______ | _______ | _______ |
| March 31, 2016 inventory | ______ | _______ | $_______ |
3. Weighted average (For the weighted average method, round the average cost per unit to two decimal places.)
| FRATE COMPANY | |||
| Computation of Inventory for Product Ply Under Weighted Average Inventory Method | |||
| March 31, 2016 | |||
| Units | Unit cost | Total cost | |
| Beginning inventory | ______ | $______ | $______ |
| January 6, 2016 | ______ | _______ | _______ |
| January 25, 2016 | ______ | _______ | _______ |
| February 17, 2016 | ______ | _______ | _______ |
| March 27, 2016 | ______ | _______ | _______ |
| Total | ______ | $______ | |
| Weighted average cost | $______ | ||
| March 31, 2016 inventory | ______ | $______ | $_______ |
In: Accounting