-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mishina violetta #64
Open
Violettam88
wants to merge
7
commits into
Nastasia8:Mishina_Violetta
Choose a base branch
from
Violettam88:Mishina_Violetta
base: Mishina_Violetta
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mishina violetta #64
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eefb422
Create 1.cpp
Violettam88 b6bb879
Create 2.cpp
Violettam88 fc4dac8
Create 3.cpp
Violettam88 0f45e28
Create 1.cpp
Violettam88 ede45ab
Create 2
Violettam88 535a131
Update and rename 2 to 2.cpp
Violettam88 ccd268b
Update 2.cpp
Violettam88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
using namespace std; | ||
|
||
class Students | ||
{ | ||
private: | ||
string name; | ||
string last_name; | ||
string patronymic; | ||
int group; | ||
int kurs; | ||
int age; | ||
|
||
string vname(string name) | ||
{ | ||
if (name == " ") | ||
{ | ||
cout << " Name = " << endl; | ||
cin >> name; | ||
} | ||
return name; | ||
} | ||
|
||
string vlast_name(string last_name) | ||
{ | ||
if (last_name == " ") | ||
{ | ||
cout << "Last_name = " << endl; | ||
cin >> last_name; | ||
} | ||
return last_name; | ||
} | ||
|
||
string vpatronymic(string patronymic) | ||
{ | ||
if (patronymic == " ") | ||
{ | ||
cout << "Patronymic= " << endl; | ||
cin >> patronymic; | ||
|
||
} | ||
return patronymic; | ||
} | ||
|
||
int vgroup(int group) | ||
{ | ||
if (group == 0) | ||
{ | ||
cout << "Group = " << endl; | ||
cin >> group; | ||
} | ||
return group; | ||
} | ||
|
||
int vkurs(int kurs) | ||
{ | ||
if (kurs == 0) | ||
{ | ||
cout << "Kurs = " << endl; | ||
cin >> kurs; | ||
} | ||
return group; | ||
} | ||
|
||
int vage(int age) | ||
{ | ||
if (age == 0) | ||
{ | ||
cout << "Age = " << endl; | ||
cin >> age; | ||
} | ||
return age; | ||
} | ||
|
||
public: | ||
Students (string name, string last_name, string patronymic, int group, int kurs, int age) | ||
{ | ||
this->name = vname(name); | ||
this->last_name = vlast_name(last_name); | ||
this->patronymic = vpatronymic(patronymic); | ||
this->group = vgroup(group); | ||
this->kurs = vkurs(kurs); | ||
this->age = vage(age); | ||
this->name = name + " " + last_name + " " + patronymic; | ||
} | ||
|
||
void show() | ||
{ | ||
cout << "Name " << name << endl; | ||
cout << "Last_ame " << last_name << endl; | ||
cout << "Patronymic " << patronymic << endl; | ||
cout << "Group " << group << endl; | ||
cout << "Kurs " << kurs << endl; | ||
cout << "Age " << age << endl; | ||
} | ||
}; | ||
int main() | ||
{ | ||
Students One(" "," ", " ", 0, 0, 0); | ||
Students Two(" ", " ", " ", 0, 0, 0); | ||
Students Three(" ", " ", " ", 0, 0, 0); | ||
One.show(); | ||
Two.show(); | ||
Three.show(); | ||
|
||
return 0; | ||
} | ||
|
||
|
||
// помогала Екатерина Завидина с условием задачи |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <fstream> // загрузка библиотеки для работы с файлами | ||
|
||
using namespace std; | ||
|
||
class Employee | ||
{ | ||
private: | ||
string full_name; | ||
string position; | ||
string home_address; | ||
int experience; | ||
string phone_number; | ||
int number_of_hours_worked; | ||
int cost_of_an_hour_of_work; | ||
|
||
string vfull_name(string full_name) | ||
{ | ||
if (full_name == " ") | ||
{ | ||
cout << "Full_name = "; | ||
getline(cin, full_name); | ||
} | ||
return full_name; | ||
} | ||
|
||
string vposition(string position) | ||
{ | ||
if (position == " ") | ||
{ | ||
cout << "Position = "; | ||
cin >> position; | ||
} | ||
return position; | ||
} | ||
|
||
string vhome_address(string home_address) | ||
{ | ||
if (home_address == " ") | ||
{ | ||
cout << "Home_address= "; | ||
getline(cin, home_address); | ||
|
||
} | ||
return home_address; | ||
} | ||
|
||
int vexperience(int experience) | ||
{ | ||
if (experience == 0) | ||
{ | ||
cout << "Experience = "; | ||
cin >> experience; | ||
} | ||
return experience; | ||
} | ||
|
||
string vphone_number(string phone_number) | ||
{ | ||
if (phone_number == "") | ||
{ | ||
cout << "Phone_number "; | ||
cin >> phone_number; | ||
} | ||
return phone_number; | ||
} | ||
|
||
int vnumber_of_hours_worked(int number_of_hours_worked) | ||
{ | ||
if (number_of_hours_worked == 0) | ||
{ | ||
cout << "Number_of_hours_worked = "; | ||
cin >> number_of_hours_worked; | ||
} | ||
return number_of_hours_worked; | ||
} | ||
|
||
int vcost_of_an_hour_of_work(int cost_of_an_hour_of_work) | ||
{ | ||
if (cost_of_an_hour_of_work == 0) | ||
{ | ||
cout << "cost_of_an_hour_of_work = " << endl; | ||
cin >> cost_of_an_hour_of_work; | ||
} | ||
return cost_of_an_hour_of_work; | ||
} | ||
public: | ||
Employee() : full_name("Mishina Violetta Aleksandrovna"), position("disigner"), home_address("Ivanovo, Kalina street, building 20, apartment 28"), experience(1), phone_number("+79158175317"), number_of_hours_worked(560), cost_of_an_hour_of_work(400) {}; | ||
Employee(string full_name, string position, string home_address, int experience, string phone_number, int number_of_hours_worked, int cost_of_an_hour_of_work) | ||
{ | ||
this->full_name = vfull_name(full_name); | ||
this->position = vposition(position); | ||
this->home_address = vhome_address(home_address); | ||
this->experience = vexperience(experience); | ||
this->phone_number = vphone_number(phone_number); | ||
this->number_of_hours_worked = vnumber_of_hours_worked(number_of_hours_worked); | ||
this->cost_of_an_hour_of_work = vcost_of_an_hour_of_work(cost_of_an_hour_of_work); | ||
} | ||
void show() | ||
{ | ||
string soglasie; | ||
cout << "Full name " << full_name << endl; | ||
cout << "Position " << position << endl; | ||
cout << "Home address " << home_address << endl; | ||
cout << "Experience " << experience << endl; | ||
cout << "Phone number " << phone_number << endl; | ||
cout << "Number of hours worked " << number_of_hours_worked << endl; | ||
cout << "Cost of an hour of work " << cost_of_an_hour_of_work << endl; | ||
cout << "Wages " << wages() << endl; | ||
cout << "Bonus " << bonus() << endl; | ||
cout << "Create file with this information? \nEnter yes/any other key(no): "; | ||
cin >> soglasie; | ||
if (soglasie == "yes") | ||
{ | ||
ofstream info; | ||
info.open(full_name + ".txt"); // создаёт или открывает файл | ||
info << "Full name " << full_name << endl; | ||
info << "Position " << position << endl; | ||
info << "Home address " << home_address << endl; | ||
info << "Experience " << experience << endl; | ||
info << "Phone number " << phone_number << endl; | ||
info << "Number of hours worked " << number_of_hours_worked << endl; | ||
info << "Cost of an hour of work " << cost_of_an_hour_of_work << endl; | ||
info << "Wages " << wages() << endl; | ||
info << "Bonus " << bonus() << endl; | ||
info.close(); | ||
} | ||
} | ||
int wages() | ||
{ | ||
return number_of_hours_worked * cost_of_an_hour_of_work; | ||
} | ||
float bonus() | ||
{ | ||
if (experience >= 1) | ||
{ | ||
if (experience >= 3) | ||
{ | ||
if (experience >= 6) | ||
{ | ||
if (experience >= 10) | ||
{ | ||
return (float)number_of_hours_worked * cost_of_an_hour_of_work*13/100; | ||
} | ||
return (float)number_of_hours_worked * cost_of_an_hour_of_work * 7 / 100; | ||
} | ||
return (float)number_of_hours_worked * cost_of_an_hour_of_work * 5 / 100; | ||
} | ||
return (float)number_of_hours_worked * cost_of_an_hour_of_work * 3 / 100; | ||
} | ||
} | ||
}; | ||
int main() | ||
{ | ||
Employee One; | ||
Employee Two("Veselov Oleg Borisovich", "Plumber", "Moscow, Leninsky prospect, building 5, apartment 16", 5, "+ 79883275603", 956, 300); | ||
Employee Three("Smirnov Ivan Olegovich", "Driver", "Ivanovo, Thunderbolt street, building 17, apartment 83 ",13, "+ 79998235625", 3460, 380); | ||
One.show(); | ||
Two.show(); | ||
Three.show(); | ||
|
||
return 0; | ||
} | ||
// помогал Евгений Смуров с инициализацией полей класса |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все ясно с Вами - position("disigner") :)