You are on page 1of 3

NAME : YOGA AFIF NURRAHMAN

Imports System.IO Imports System Imports System.Math Module Module1 Dim a As String Dim choice As String Sub Main() 'bagian 1 tanya() While a <> "x" If a = "a" Then file2() End If ' if untuk si "a" If a = "b" Then Console.WriteLine("UserName: System.Environment.UserName) Console.WriteLine("SystemDirectory: System.Environment.SystemDirectory) Console.WriteLine("OSVersion: System.Environment.OSVersion.VersionString) Console.WriteLine("MachineName: System.Environment.MachineName) Console.ReadKey() tanya() End If

" & " & " & " &

If a = "c" Then Dim loopCounter, x, y, a, b, c, n As Decimal Dim nama, lokasi, join, gabung As String Console.Write("How many times do you want? ") n = Console.ReadLine()

For loopCounter = 1 To n Console.Write("Input a: ") a = Console.ReadLine() Console.Write("Input b: ") b = Console.ReadLine() Console.Write("Input c: ") c = Console.ReadLine() y = (b ^ -(4 * a * c)) x = (-b + ((Sqrt(y)))) / (2 * a) Console.WriteLine("The Result is: " & x) Console.ReadKey() Next Console.Write("input file (example:ada.txt) : ") nama = Console.ReadLine() Console.Write("input lokasi(example: d:\ ) : ") lokasi = Console.ReadLine() Join = lokasi & nama gabung = a & b & c & x

If File.Exists(Join) = True Then Console.Clear() Console.WriteLine("file : " & join & " sudah ada") Console.WriteLine("the a value : " & a) Console.WriteLine("the b value : " & b) Console.WriteLine("the c value : " & c) Console.WriteLine("the result by the formula : " & x) My.Computer.FileSystem.WriteAllText(Join, a & b & c & x, False) Console.WriteLine("data anda telah tesimpan ") Console.WriteLine("isi file: " & join & " adalah " & My.Computer.FileSystem.ReadAllText(join)) Console.ReadKey() tanya() End If End If If a = "d" Then pilihan() If choice = "a" Then Process.Start("calc.exe") ElseIf choice = "b" Then Process.Start("cmd.exe") ElseIf choice = "c" Then Process.Start("notepad.exe") End If End If tanya() If a <> "a" And a <> "x" And a <> "b" Then tanya() End If End While End Sub Sub tanya() Console.WriteLine("choice : ") Console.WriteLine("") Console.WriteLine("a. input file") Console.WriteLine("b. computer system") Console.WriteLine("c. program with input") Console.WriteLine("d. running a program") Console.WriteLine("x. exit") Console.WriteLine("") Console.Write("input your choice: ") a = Console.ReadLine() End Sub Sub pilihan() Console.WriteLine("which program do you want to run ?") Console.WriteLine("") Console.WriteLine("a. calculator") Console.WriteLine("b. Command prompt") Console.WriteLine("c. notepad") Console.WriteLine("") Console.WriteLine("your choice: ") choice = Console.ReadLine() End Sub Sub file2()

Dim nama, lokasi, gabung As String Dim fileDetail As IO.FileInfo Console.Write("input file (example:ada.txt) : ") nama = Console.ReadLine() Console.Write("input lokasi(example: d:\ ) : ") lokasi = Console.ReadLine() gabung = lokasi & nama

If File.Exists(gabung) = True Then Console.Clear() Console.WriteLine("file :" + gabung + " sudah ada") Console.WriteLine("==============================================") Console.WriteLine(" information file") Console.WriteLine("file dibuat tanggal =" & File.GetCreationTime(gabung)) Console.WriteLine("file terakhir ditulis = " & File.GetLastWriteTime(gabung)) Console.WriteLine("file terakhir diakses =" & File.GetLastAccessTime(gabung)) fileDetail = My.Computer.FileSystem.GetFileInfo(gabung) Console.WriteLine("ukuran file " & gabung & " Size: " & fileDetail.Length & " byte(s)") Console.ReadKey() tanya() Else Console.Clear() Console.WriteLine("file yang anda input: " + gabung + " tidak ada") Console.ReadKey() tanya() End If End Sub End Module

You might also like