first semester files

This commit is contained in:
2024-02-22 14:31:08 -05:00
parent 0f26c9f73d
commit 2d4bbf49a4
242 changed files with 360411 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
/***************************************************************
* Name: Aidan Sharpe
* Course: Computer Science & Programming
* Class: CS04103 Section: 6
* Assignment Date: 09.29.2021
* File Name: Lab03-1ASharpe.cpp
*****************************************************************
* ID: Lab 3 Problem 1
* Purpose: Determine and print whether or not a given year is a leap year
*****************************************************************/
#include <iostream>
using namespace std;
int main()
{
int year;
// ask the user for a year
cout << "Enter a year: ";
cin >> year;
// cout << "\n\n";
// determine if the year is a leap year
// if
// cout << year << " is a leap year.";
// else
// cout << year << " is not a leap year.";
cout << " is" << (( year >= 1582 && (year % 100 != 0 || year % 400 == 0) && year % 4 == 0) ? " " : " not ") << "a leap year.";
return 0;
}

View File

@@ -0,0 +1,43 @@
/***************************************************************
* Name: Aidan Sharpe
* Course: Computer Science & Programming
* Class: CS04103 Section: 6
* Assignment Date: 09.29.2021
* File Name: Lab03-2ASharpe.cpp
*****************************************************************
* ID: Lab 3 Problem 2
* Purpose: Computes and prints the price of a speeding ticket given a car speed in a 55 Mph zone
*****************************************************************/
#include <iostream>
using namespace std;
int main()
{
const int SPEED_LIMIT = 55;
int speed;
// ask the cop for the speed of the vehicle
cout << "Enter the speed between 0 and 150 Mph: ";
cin >> speed;
cout << "\n\n";
// determine the cost of the ticket if the driver was speeding
if ( speed > SPEED_LIMIT && speed < 150 )
// determine which ticket cost range applies
if ( speed - (SPEED_LIMIT + 20) >= 0)
cout << "The price of the ticket is $" << 50 + 5 * (speed - SPEED_LIMIT);
else
cout << "The price of the ticket is $" << 50 + 2 * (speed - SPEED_LIMIT);
// determine if the vehicle was actually speeding
else if ( speed <= SPEED_LIMIT )
cout << "The driver was not speeding.";
// if the driver is reckless
else
cout << "The driver should be arrested.";
return 0;
}