In: Biology
The local taqueria wants you to write a program which tracks the number of burritos they sell each day and help them analyze their business.
Your C++ program should ask the user for the number of different burrito types sold, then get the names of the types and the number of burritos sold of each type of that day. Print out a daily report listing sales for each burrito type and total number of all burritos sold.
So far, this sounds very similar to a previous exercise! This difference this time is that you must use a struct called SalesRecord which has two fields -- a string containing the name of the burrito, and an int containing the number of burritos sold of this type. You must have one dynamically allocated array of SalesRecord structs.
SAMPLE OUTPUT:
Enter the number of different types sold: 4
Enter the name of the burrito 1: chicken
Enter the number of burritos sold of this type: 4
Enter the name of the burrito 2: pork
Enter the number of burritos sold of this type: 3
Enter the name of the burrito 3: shrimp
Enter the number of burritos sold of this type: 7
Enter the name of the burrito 4: california
Enter the number of burritos sold of this type: 9
Burrito Name Burrito Count
------------------------------------------
chicken 4
pork 3
shrimp 7
california 9
The total number of burritos sold for 4 types: 23
In: Computer Science
Write the class MultiDimList according to the following requirements:
The List will have the following:
Implement and test the following methods:
Input File:
Number of students
Name, ID, Mark separated by space
Testing:
Marking Scheme:
5 Marks/method.
5 Marks for the main method.
5 Marks creativity.
Total out of 40.
In: Advanced Math
Write a program called whilebun.py, in which the user is asked to guess the name of your favorite DBVac vacuum cleaner model. Your program should:
· Include a comment in the first line with your name.
· Include comments describing each major section of code.
· Set a variable called vacname to be equal to the name of your favorite DBVac vacuum cleaner model.
· Ask the user to guess the name. Allow the user to make up to three guesses, evaluating each guess for correctness immediately after the guess is made.
o The user’s guess shouldn’t be required to be case sensitive to be correct. For instance, if your favorite model is the Hare Razer, but the user inputs “HARE RAZER”, then that should be counted correct (as should “hare razer”, “hArE rAzEr” and any other combination of capital and lower-case letters).
o If the user guesses wrong, let them know, tell them how many guesses they have left, and have them guess again (up to three guesses total).
· If the user guesses the correct name:
o Stop asking the user to guess (even if they have not yet guessed three times).
o Congratulate the user on their guessing skills.
o Tell the user how many guesses it took them to guess correctly.
· If the user runs out of guesses without guessing the correct name:
o Console the user by telling them that, while they have failed in this task, it’s going to be okay.
In: Computer Science
Debug the pet.h file and pet.cpp file (I would like to check my work)
#ifnotdef PET_H
#then_define PET_H
#include <string>
using name space std
namespace fhsuzeng
{
Class Pet
{
public
Pet();
void setName(string name);
string getName() const;
void setAge(double age);
int getAge() const;
virtual void talk();
private:
string _name; int _age;
};
class Dog::public Pet
{
public:
Dog();
void setBreed(string breed);
string getBreed() const;
private: string _breed;
}
class Cat:Pet
{
Public:
Cat();
void setColor(string color);
string getColor() const;
private:
string _color;
};
}; #endif
The above is pet.h file and the following is the file pet.cpp
#include <string>
#include <pet.h>
using name space std
namespace fhsuzeng
{
void Pet::Pet():: _name("no name yet"), _age(0){}
int Pet::getAge() const { return age; }
void Pet::setAge(int age) { age = age; }
string Pet::getName() const { return _name }
void Pet::setName(string name) { _name = name; }
Pet::Dog(): Pet(), _breed("Any breed") {}
string Dog::getBreed() { return _breed; }
void Dog::setBreed(string breed) { _breed = breed; }
Cat::Cat(): Pet(), _color("Red")
Cat::string getColor() const { return _color; }
void Cat:: setColor(string color) { _color = color; } }
In: Computer Science
Draw a relational model for the following case
study.
Case Study
The local under-sixteen football league needs a database to help
track teams, children
that sign up to play in the league, the parents of these children
and the coaches for each
team.
The league wishes to record the details for each parent of a
particular player (the parents
last name, first name, phone contact number and address). For each
player, the system
needs to record the player's last name, first name, blood type and
their date of birth. Any
allergies that the player has also need to be recorded.
A player may only play in one team with this league. Each team is
given a unique id, the
system needs to record this id, the teams name, and the city their
home ground is located
(a city may have several under-sixteen teams based in it). A team’s
colours are also to be
recorded, teams may choose to use a single or multiple team
colours. A team may have
several coaches – one of the coaches is designated as the head
coach.
A coach is only permitted to coach one team in the under-sixteen
leagues. All
communications from the league to the team are via the head coach.
To be registered to
play in this league a team must have a head coach and at least one
player. The database
needs to track a coach's first and last name, phone and address
contact details and the
team that they are coaching.
In: Computer Science
HW_6d - Write a struct object to a binary file.
binary file named: critters.bin
each cat.
Record written to file. (see output)
/* OUTPUT
Enter 3 cat records.
Enter information about a cat:
NAME: Tom
AGE: 5
Enter information about a cat:
NAME: Fluffy
AGE: 3
Enter information about a cat:
NAME: Sweet Pea
AGE: 2
Record written to file.
Press any key to continue . . . */
Please make the code based on C++, and make a description for each code.
In: Computer Science
Linux Question: Describe how you created above file and its contents in VI.
a) Bash/VI commands: 20pts;
b) Non-brute-force solution: 10pts).
Note: Brute-force solution means that entering characters one by one
Install JDK 1.8 by the following command: $ sudo dnf –y install java-1.8.0-openjdk-devel.x86_64
Use VI to create a file “YourFirstNameHomework.java” (e.g., “MollyHomework.java”) and add the following contents into it.
(grading details: file name format:10 pts, a screenshot of the file content in the VI environment: 10pts, paragraphs: 10pts, empty lines and indentations: 10, text: 10pts)
import java.util.Scanner; // Import the Scanner class
class CynthiaHomework {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter your first name");
String fName = myObj.nextLine(); // Read user input of the first name
System.out.println("Enter your last name");
String lName = myObj.nextLine(); // Read user input of the last name
System.out.println("Hello " + fName + “ “ + lName); // Output user input
}
}
To compile the above java code, run the following command (you need to use your java file name): $ javac MollyHomework.java
To execute the java program, run the following command $ java MollyHomework
In: Computer Science
Write a java program using the following instructions:
Write a program that determines election results. Create two parallel arrays to store the last names of five candidates in a local election and the votes received by each candidate. Prompt the user to input these values. The program should output each candidates name, the votes received by that candidate, the percentage of the total votes received by the candidate, and the total votes cast. Your program should also output the winner of the election. To do this, write the following method: findHighest which receives an array of int. It determine the highest value in the array and returns the location of that value. Call this method to determine the location of the highest value in your votes array, and use this to display the winner from the names array.
SAMPLE OUTPUT:
Enter candidate name: Johnson
Enter votes received: 5000
Enter candidate name: Miller
Enter votes received: 4000
Enter candidate name: Duffy
Enter votes received: 6000
Enter candidate name: Robinson
Enter votes received: 2500
Enter candidate name: Ashton
Enter votes received: 1800
Candidate Votes Received % of Total
Johnson 5000 25.91
Miller 4000 20.72
Duffy 6000 31.09
Robinson 2500 12.95
Ashton 1800 9.33
Total votes: 19300
The winner of the election is Duffy.
In: Computer Science
d_state.h:
#ifndef STATECITY_CLASS
#define STATECITY_CLASS
#include
#include
using namespace std;
// object stores the state name and city in the state
class stateCity
{
public:
stateCity (const string& name = "", const string& city = "");
// output the state and city name in the format
// cityName, stateName
friend ostream& operator<< (ostream& ostr, const stateCity& state;
// operators < and == must be defined to use with set object.
// operators use only the stateName as the key
friend bool operator< (const stateCity& a, const stateCity& b);
friend bool operator== (const stateCity& a, const stateCity& b);
private:
string stateName, cityName;
};
#endif // STATECITY_CLASS
Please write in C++
In: Computer Science