This file contains hidden or 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
It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet. | |
Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 * 19 * 1 * 3 * 15 = 17955. If the group's number mod 47 is the |
This file contains hidden or 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? |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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. |