Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions Aktardb.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#include <iostream>

using namespace std;

// CLASS DECLARATION

class DB
{

public:
void store();
void viewChronologically();
void sortbyPartID();
void viewbyPartID();

private:
class Part // This "public class" could also be a "struct" instead.
{
public:
int sl;
int ID;
float Price;
int Quantity;
Part(void){};
Part(int Partnum, float rate, int quant)
{
ID = Partnum;
Price = rate;
Quantity = quant;
} // DO: Initialize appropriately.

void store(int s)
{
sl = s;
// DO: Fill in prompts and input statements as indicated by the
cout << "Enter ID: ";
cin >> ID;
cout << "Enter Unit Price: ";
cin >> Price;
cout << "Enter Inventory Quantity: ";
cin >> Quantity;
// sample output:
};

void print()
{
cout << "Part ID: " << ID << "\tUnit Price = " << Price << "\t\tInventory = " << Quantity << endl;
};
};

Part n1, n2, n3;

Part *IDp1, *IDp2, *IDp3;

void swap(Part *a, Part *b);
void sortbyChronologicalOrder();
};

// CLASS DEFINITION
void DB::store()
{

cout << "Input ID, price, and quantity for three parts, as prompted" << endl;

cout << "Part 1:" << endl;
n1.store(1);

cout << "Part 2:" << endl;
n2.store(2);

cout << "Part 3:" << endl;
n3.store(3);

IDp1 = &n1;
IDp2 = &n2;
IDp3 = &n3;

// DO: Print a thank you message after storing as indicated in the
cout << "Thank you. The three parts have been securely stored in the database." << endl;

// sample output:
};

void DB::viewChronologically()
{
sortbyChronologicalOrder();
cout << "The three items in the database (in chronological order) are: " << endl;

n1.print();
n2.print();
n3.print();
};

// DO: Fill in the definition for the swap method in the DB class:

void DB::swap(DB::Part *a, Part *b)
{
Part temp;
temp = *a;
*a = *b;
*b = temp;
};

void DB::sortbyPartID()
{

if (IDp1->ID > IDp2->ID)
swap(IDp1, IDp2);

if (IDp2->ID > IDp3->ID)
{
swap(IDp2, IDp3);

if (IDp1->ID > IDp2->ID)
swap(IDp1, IDp2);
}
};

void DB::sortbyChronologicalOrder()
{
if (IDp1->sl > IDp2->sl)
swap(IDp1, IDp2);

if (IDp2->sl > IDp3->sl)
{
swap(IDp2, IDp3);

if (IDp1->sl > IDp2->sl)
swap(IDp1, IDp2);
}
}

void DB::viewbyPartID()
{
// DO: Fill in based on sample output:
cout << "The three items in the database (sorted by part ID) are:" << endl;

n1.print();
n2.print();
n3.print();
};

int main()
{

DB DB1;
DB1.store();
DB1.sortbyPartID();
DB1.viewbyPartID();
DB1.viewChronologically();

cout << "Have a good day! Bye!" << endl;

exit(0);
};
47 changes: 47 additions & 0 deletions Form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML FORM</title>
<style>
.center {
margin: auto;
width: 30%;
border: 3px solid green;
padding: 10px;
}
</style>
</head>

<body>
<!-- Create a form for accept lastname, contact number, gender, hubbies, country, button for reset and submit -->
<div class="center">
<form>
First Name : <input type="text" name="firstname" placeholder="Balgopal"> <br>
Last Name : <input type="text" name="lastname" placeholder="Patro"> <br>
Contact No : <input type="text" name="contactno" placeholder="9178922478"> <br>
Gender:<input type="radio" name="gender" value="male" required>Male
<input type="radio" name="gender" value="female">Female<br> <br>
Hubbies : <br> <input type="checkbox" id="programming" name="programming" value="Programming">
<label for="programming"> Programming</label><br>
<input type="checkbox" id="Sports" name="Sports" value="Sports">
<label for="Sports"> Sports</label><br>
<input type="checkbox" id="Reading" name="Reading" value="Reading">
<label for="Reading"> Reading</label><br><br>
Country : <select name="country" required>
<option value="">Select Country</option>
<option value="India">India</option>
<option value="USA">USA</option>
<option value="UK">UK</option>
<option value="Canada">Canada</option>
</select> <br> <br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</form>
</div>
</body>

</html>
Binary file added SamsREFUND.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions comp.py.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"1\n",
"[1]\n",
"1\n",
"2\n",
"[1, 2]\n",
"5\n",
"4\n",
"[1, 2, 3, 4]\n",
"119\n"
]
}
],
"source": [
"# cook your dish here\n",
"n = int(input())\n",
"for i in range(n):\n",
" x = input()\n",
" x = int(x)\n",
" l = [j for j in range(1,x+1)]\n",
" print(l)\n",
" while len(l) != 1:\n",
" f = l[0]\n",
" la = l[-1]\n",
" l = l[1:-1]\n",
" l.append(f + la + f*la)\n",
" \n",
" print(l[0]%1000000007)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"2\n",
"5\n",
"5\n",
"719\n",
"4\n",
"119\n"
]
}
],
"source": [
"n = int(input())\n",
"l = [1]\n",
"for i in range(1,1000001):\n",
" l.append((l[i-1] * i)% 1000000007)\n",
"for i in range(n):\n",
" x = input()\n",
" x = int(x)\n",
" print(l[x+1]-1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4\n",
"cabbac\n",
"YES\n"
]
}
],
"source": [
"t = int(input())\n",
"for i in range(t):\n",
" s = input()\n",
" l = [s.count(i)%2 for i in s]\n",
" if 1 in l:\n",
" print('NO')\n",
" else:\n",
" print('YES')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "7\n"
}
],
"source": [
"n = int(input())\n",
"st = {}\n",
"for i in range(n):\n",
" l = input().split(\" \")\n",
" l = [int(j) for j in l]\n",
" for j in range(l[0],l[1]):\n",
" st[j] = 1\n",
"print(len(st))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3-final"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading