This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <fstream> | |
// Creates the structure Scenea | |
struct Scene { | |
// Constructor that passes the arguments to text and to next which sets scene_text to the value of text and next_scenes to the value of next | |
Scene(std::string text, std::vector<int> const& next) { | |
scene_text = text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Write a program that lets a maker of chips and salsa keep track of their sales | |
for five different types of salsa they produce: mild, medium, sweet, hot, and | |
zesty. It should use two parallel five-element arrays: an array of strings that | |
holds the five salsa names and an array of integers that holds the number of jars | |
sold during the past month for each salsa type. The salsa names should be stored | |
using an initialization list at the time the name array is created. The program | |
should prompt the user to enter the number of jars sold for each type. Once this | |
sales data has been entered, the program should produce a report that displays | |
sales for each salsa type, total sales, and the names of the highest selling and | |
lowest selling products. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* An Internet service provider has three different subscription packages | |
* for its customers. | |
* | |
* Package A: For $9.95 per month 10 hours of access access are | |
* provided. Additional hours are $2.00 per hour. | |
* | |
* Package B: For $13.95 per month 20 hours of access are provided. | |
* Additional hours are $1.00 per hours. | |
* | |
* Package C: For $19.95 per month unlimited access is provided. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class BarChart { | |
public static void main(String[] args) | |
{ | |
double[] store = new double[5]; | |
Scanner userInput = new Scanner(System.in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
void sleep(unsigned int mseconds) | |
{ | |
clock_t goal = mseconds + clock(); | |
while (goal > clock()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SavingsAccount { | |
private double annualInterestRate, balance, accumulativeInterest, accumulativeDeposits = 0, accumulativeWithdrawals = 0; | |
// Constructor | |
public SavingsAccount(double b) | |
{ | |
balance = b; | |
} | |
// Mutators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Opens files | |
BufferedReader deposits = new BufferedReader(FileReader("Deposits.txt"); | |
BufferedReader withdraws = new BufferedReader(FileReader("Withdrawals.txt"); | |
// Reads from files and prints to console | |
String depositString; | |
String withdrawString; | |
double deposit; | |
double withdraw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "../Header/Character.h" | |
#include <iostream> | |
#include <fstream> | |
/******************** | |
* PRIVATE METHODS * | |
********************/ | |
void Character::setExperience(int experience) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void loadBooks(ArrayList<Book> books, String fileName) | |
{ | |
try(Scanner scanner = new Scanner(new File(fileName))) | |
{ | |
String currentLine; | |
String delims = ", "; | |
String[] tokens; | |
scanner.useDelimiter(", "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This may be a bit off-topic for this channel. I have a programmer who is above me who insists on using a code generator for a project. I experimented with the generator and I have a few issues with it. My biggest issueis that it generates messy code. It doesn't take advantage of C++ conventions and it clearly Java with a few tweaks to make it compile with a C++ compiler. I'm also afraid that some of the programmers on the team with less experience won't know what the underlying code does. Any ideas on how to express this to a superior? |
OlderNewer