NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Lab 05


#include <iostream>
#include <math.h>
class rectangle {
public:
//Constructor
rectangle(){
for(int i =0; i<6; i++) {
if(i ==0 || i == 5) {
for(int i =0; i<17; i++){
std::cout<<"*";
}
}
std::cout<<"*tt *"<<"n";
}
}
~rectangle(){};
//Functions

void setShort(int shortf) {
this->shortf = shortf;
}
int getShort() {
return shortf;
}
void setLong(int longf) {
this->longf = longf;
}
int getLong() {
return longf;
}
void calculateArea(int longg, int shortt) {
int result = longg * shortt;
std::cout<<"Area Of The rectangle is: "<<result<<"n";
}
void calculatecircum (int longg, int shortt) {
int result = (longg*2) + (shortt*2);
std::cout<<"The circumference of the rectangle is: "<<result<<"n";
}
void calculatediagonal(int longg, int shortt) {
double res = pow(longg,2) + pow(shortt,2);
double result = sqrt(res);
std::cout<<"The diagonal lenght of rectangle is : "<<result<<"n";

}
private:
int shortf;
int longf;
};

int main () {
int at =10;
int choice;
int x,y;
rectangle a1;
//Set Long Edge
std::cout<<"Enter the long edge: ";
std::cin>>x;
a1.setLong(x);
//Set short Edge
std::cout<<"Enter the short edge: ";
std::cin>>y;
a1.setShort(y);
while(at==10){
std::cout<<"Press 1 to calculate area of rectanglen";
std::cout<<"Press 2 to calculate circumferencen";
std::cout<<"Press 3 to calculate diagonal lengthn";
std::cout<<"Press 4 to quit";
std::cin>>choice;
switch(choice) {
case 1:
a1.calculateArea(a1.getLong(),a1.getShort());
break;
case 2:
a1.calculatecircum(a1.getLong(),a1.getShort());
break;
case 3:
a1.calculatediagonal(a1.getLong(),a1.getShort());
break;
case 4:
at = 11;
break;

}
}
}


LAB 06
#include <iostream>
#include <string>

class lesson
{
public:
lesson()
{
}
void setTitle(std::string title)
{
this->title = title;
}
std::string getTitle()
{
return this->title;
}
void setCredit(int credit)
{
this->credit = credit;
}
int getCredit()
{
return this->credit;
}
void setCode(std::string code)
{
this->code = code;
}
std::string getCode()
{
return this->code;
}

private:
std::string title;
std::string code;
int credit;
};

int main()
{
int department;
int a =1;
while (a != 4)
{
std::cout << "nPlease enter the value of your department:n";
std::cout << "1- Software Engineern";
std::cout << "2- Psychologyn";
std::cout << "For exit press 4:n ";
std::cin >> department;
if (department == 1)
{
//Lesson 1 For SENG
lesson datastru;
datastru.setTitle("Data Structures");
datastru.setCredit(4);
datastru.setCode("Comp217");
std::cout << "nTitle of lesson is: " << datastru.getTitle() << "n";
std::cout << "nCredit of lesson is: " << datastru.getCredit() << "n";
std::cout << "nCode of lesson is: " << datastru.getCode() << "n";
for (int i = 0; i < 30; i++)
{
std::cout << "-";
}
//Lesson 2 For SENG
lesson objectori;
objectori.setTitle("Object Orianted");
objectori.setCredit(3);
objectori.setCode("Comp218");
std::cout << "nTitle of lesson is: " << objectori.getTitle() << "n";
std::cout << "nCredit of lesson is: " << objectori.getCredit() << "n";
std::cout << "nCode of lesson is: " << objectori.getCode() << "n";
for (int i = 0; i < 30; i++)
{
std::cout << "-";
}
//Lesson 3 For SENG
lesson algorithm;
algorithm.setTitle("Analysis Of Algorithm");
algorithm.setCredit(3);
algorithm.setCode("Comp335");
std::cout << "nTitle of lesson is: " << algorithm.getTitle() << "n";
std::cout << "nCredit of lesson is: " << algorithm.getCredit() << "n";
std::cout << "nCode of lesson is: " << algorithm.getCode() << "n";
}else if(department==2) {
lesson intro;
intro.setTitle("Intro To Psychology");
intro.setCredit(5);
intro.setCode("PSYC107");
std::cout << "nTitle of lesson is: " << intro.getTitle() << "n";
std::cout << "nCredit of lesson is: " << intro.getCredit() << "n";
std::cout << "nCode of lesson is: " << intro.getCode() << "n";
for (int i = 0; i < 30; i++)
{
std::cout << "-";
}
lesson biol;
biol.setTitle("Biological basis of behavior");
biol.setCredit(3);
biol.setCode("BIOL105");
std::cout << "nTitle of lesson is: " << biol.getTitle() << "n";
std::cout << "nCredit of lesson is: " << biol.getCredit() << "n";
std::cout << "nCode of lesson is: " << biol.getCode() << "n";
for (int i = 0; i < 30; i++)
{
std::cout << "-";
}
lesson evol;
evol.setTitle("Evolution Of Psychology");
evol.setCredit(6);
evol.setCode("PSYC221");
std::cout << "nTitle of lesson is: " << evol.getTitle() << "n";
std::cout << "nCredit of lesson is: " << evol.getCredit() << "n";
std::cout << "nCode of lesson is: " << evol.getCode() << "n";
for (int i = 0; i < 30; i++)
{
std::cout << "-";
}
}else if(department==4) {
a=4;
}

}
return 0;
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.